Skip to content

Provide an option to not verify the domain #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 29, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions giturlparse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from giturlparse.result import GitUrlParsed


def parse(url):
return GitUrlParsed(_parse(url))
def parse(url, check_domain=True):
return GitUrlParsed(_parse(url, check_domain))

def validate(url):
return parse(url).valid
def validate(url, check_domain=True):
return parse(url, check_domain).valid
9 changes: 5 additions & 4 deletions giturlparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)


def parse(url):
def parse(url, check_domain=True):
# Values are None by default
parsed_info = defaultdict(lambda: None)

Expand All @@ -35,9 +35,10 @@ def parse(url):
# Skip if domain is bad
domain = match.group('domain')
#print('[%s] DOMAIN = %s' % (url, domain,))
if platform.DOMAINS and not(domain in platform.DOMAINS):
#print("domain: %s not in %s" % (domain, platform.DOMAINS))
continue
if check_domain:
if platform.DOMAINS and not(domain in platform.DOMAINS):
#print("domain: %s not in %s" % (domain, platform.DOMAINS))
continue

# Get matches as dictionary
matches = match.groupdict()
Expand Down