Skip to content

Commit

Permalink
provided default value for is_public_email_domain()
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibhas committed Apr 5, 2018
1 parent 38d71ee commit c01404f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hasjob/forms/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def validate_auto_domains(self, field):
# FIXME: This will break domains where the subdomain handles email
r = tldextract.extract(item.lower())
d = u'.'.join([r.domain, r.suffix])
if not is_public_email_domain(d):
if not is_public_email_domain(d, default=False):
domains.add(d)
field.data = list(domains)

Expand Down
2 changes: 1 addition & 1 deletion hasjob/forms/jobpost.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def validate(self):
if domain and domain.is_banned:
self.poster_email.errors.append(_(u"%%s is banned from posting jobs on Hasjob") % domain_name)
success = False
elif (not self.job_type_ob.webmail_allowed) and is_public_email_domain(domain_name):
elif (not self.job_type_ob.webmail_allowed) and is_public_email_domain(domain_name, default=False):
self.poster_email.errors.append(
_(u"Public webmail accounts like Gmail are not accepted. Please use your corporate email address"))
success = False
Expand Down
2 changes: 1 addition & 1 deletion hasjob/models/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get(cls, name, create=False):
name = name.lower()
result = cls.query.filter_by(name=name).one_or_none()
if not result and create:
result = cls(name=name, is_webmail=is_public_email_domain(name))
result = cls(name=name, is_webmail=is_public_email_domain(name, default=False))
db.session.add(result)
return result

Expand Down
4 changes: 2 additions & 2 deletions hasjob/models/jobpost.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def url_for(self, action='view', _external=False, **kwargs):
elif action == 'manage':
return url_for('managejob', hashid=self.hashid, domain=domain, _external=_external, **kwargs)
elif action == 'browse':
if is_public_email_domain(self.email_domain):
if is_public_email_domain(self.email_domain, default=False):
return url_for('browse_by_email', md5sum=self.md5sum, _external=_external, **kwargs)
else:
return url_for('browse_by_domain', domain=self.email_domain, _external=_external, **kwargs)
Expand All @@ -349,7 +349,7 @@ def permissions(self, user, inherited=None):

@property
def from_webmail_domain(self):
return is_public_email_domain(self.email_domain)
return is_public_email_domain(self.email_domain, default=False)

@property
def company_url_domain_zone(self):
Expand Down

0 comments on commit c01404f

Please sign in to comment.