Changeset View
Changeset View
Standalone View
Standalone View
pykolab/utils.py
Show First 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | elif type(_object) == dict: | ||||
if len(result['mail']) > 0: | if len(result['mail']) > 0: | ||||
if len(result['mail'].split('@')) > 1: | if len(result['mail'].split('@')) > 1: | ||||
result['domain'] = result['mail'].split('@')[1] | result['domain'] = result['mail'].split('@')[1] | ||||
if not result.has_key('domain') and result.has_key('standard_domain'): | if not result.has_key('domain') and result.has_key('standard_domain'): | ||||
result['domain'] = result['standard_domain'] | result['domain'] = result['standard_domain'] | ||||
if 'objectclass' not in result: | |||||
result['objectclass'] = [] | |||||
vanmeeuwen: This isn't generally our coding style -- difficult to read.
This can just be:
if not result. | |||||
if result['objectclass'] is None: | |||||
result['objectclass'] = [] | |||||
if not isinstance(result['objectclass'], list): | |||||
result['objectclass'] = [result['objectclass']] | |||||
result['objectclass'] = [x.lower() for x in result['objectclass']] | |||||
return result | return result | ||||
def parse_input(_input, splitchars= [ ' ' ]): | def parse_input(_input, splitchars= [ ' ' ]): | ||||
""" | """ | ||||
Split the input string using the split characters defined | Split the input string using the split characters defined | ||||
in splitchars, and remove the empty list items, then unique the | in splitchars, and remove the empty list items, then unique the | ||||
list items. | list items. | ||||
▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines |
This isn't generally our coding style -- difficult to read.
This can just be: