Skip to content

Commit

Permalink
Merge pull request #104 from 3c2b2ff5/master
Browse files Browse the repository at this point in the history
replaced if no x in y with if x not in y
  • Loading branch information
jaqx0r authored Nov 5, 2019
2 parents 9665918 + e176a94 commit 8917cc6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions nss_cache/sources/httpsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,25 @@ def __init__(self, conf, conn=None):

def _SetDefaults(self, configuration):
"""Set defaults if necessary."""
if not 'automount_base_url' in configuration:
if 'automount_base_url' not in configuration:
configuration['automount_base_url'] = self.AUTOMOUNT_BASE_URL
if not 'passwd_url' in configuration:
if 'passwd_url' not in configuration:
configuration['passwd_url'] = self.PASSWD_URL
if not 'shadow_url' in configuration:
if 'shadow_url' not in configuration:
configuration['shadow_url'] = self.SHADOW_URL
if not 'group_url' in configuration:
if 'group_url' not in configuration:
configuration['group_url'] = self.GROUP_URL
if not 'netgroup_url' in configuration:
if 'netgroup_url' not in configuration:
configuration['netgroup_url'] = self.GROUP_URL
if not 'sshkey_url' in configuration:
if 'sshkey_url' not in configuration:
configuration['sshkey_url'] = self.SSHKEY_URL
if not 'retry_delay' in configuration:
if 'retry_delay' not in configuration:
configuration['retry_delay'] = self.RETRY_DELAY
if not 'retry_max' in configuration:
if 'retry_max' not in configuration:
configuration['retry_max'] = self.RETRY_MAX
if not 'tls_cacertfile' in configuration:
if 'tls_cacertfile' not in configuration:
configuration['tls_cacertfile'] = self.TLS_CACERTFILE
if not 'http_proxy' in configuration:
if 'http_proxy' not in configuration:
configuration['http_proxy'] = None

def GetPasswdMap(self, since=None):
Expand Down
20 changes: 10 additions & 10 deletions nss_cache/sources/ldapsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,25 @@ def _SetDefaults(self, configuration):
if 'uri' in configuration:
if configuration['uri'].startswith('ldapi://'):
configuration['uri'] = 'ldapi://' + quote(configuration['uri'][8:], '')
if not 'bind_dn' in configuration:
if 'bind_dn' not in configuration:
configuration['bind_dn'] = self.BIND_DN
if not 'bind_password' in configuration:
if 'bind_password' not in configuration:
configuration['bind_password'] = self.BIND_PASSWORD
if not 'retry_delay' in configuration:
if 'retry_delay' not in configuration:
configuration['retry_delay'] = self.RETRY_DELAY
if not 'retry_max' in configuration:
if 'retry_max' not in configuration:
configuration['retry_max'] = self.RETRY_MAX
if not 'scope' in configuration:
if 'scope' not in configuration:
configuration['scope'] = self.SCOPE
if not 'timelimit' in configuration:
if 'timelimit' not in configuration:
configuration['timelimit'] = self.TIMELIMIT
# TODO(jaq): XXX EVIL. ldap client libraries change behaviour if we use
# polling, and it's nasty. So don't let the user poll.
if configuration['timelimit'] == 0:
configuration['timelimit'] = -1
if not 'tls_require_cert' in configuration:
if 'tls_require_cert' not in configuration:
configuration['tls_require_cert'] = self.TLS_REQUIRE_CERT
if not 'tls_starttls' in configuration:
if 'tls_starttls' not in configuration:
configuration['tls_starttls'] = 0

# Translate tls_require into appropriate constant, if necessary.
Expand All @@ -223,13 +223,13 @@ def _SetDefaults(self, configuration):
elif configuration['tls_require_cert'] == 'try':
configuration['tls_require_cert'] = ldap.OPT_X_TLS_TRY

if not 'sasl_authzid' in configuration:
if 'sasl_authzid' not in configuration:
configuration['sasl_authzid'] = ''

# Should we issue STARTTLS?
if configuration['tls_starttls'] in (1, '1', 'on', 'yes', 'true'):
configuration['tls_starttls'] = 1
#if not configuration['tls_starttls']:
# if not configuration['tls_starttls']:
else:
configuration['tls_starttls'] = 0

Expand Down

0 comments on commit 8917cc6

Please sign in to comment.