projects
/
public
/
pyceo-broken.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c5c5919
)
Bug fix: build_gecos() did not include enough commas between fields.
author
Michael Spang
<mspang@uwaterloo.ca>
Sat, 3 Feb 2007 02:27:50 +0000
(21:27 -0500)
committer
Michael Spang
<mike@freyr.utgard.net>
Sat, 3 Feb 2007 02:27:50 +0000
(21:27 -0500)
pylib/csc/adm/accounts.py
patch
|
blob
|
history
diff --git
a/pylib/csc/adm/accounts.py
b/pylib/csc/adm/accounts.py
index
52eeb99
..
caa111e
100644
(file)
--- a/
pylib/csc/adm/accounts.py
+++ b/
pylib/csc/adm/accounts.py
@@
-891,14
+891,18
@@
def build_gecos(fullname=None, roomnumber=None, workphone=None, homephone=None,
if other and ':' in str(other):
raise InvalidArgument('other', other, "invalid characters")
if other and ':' in str(other):
raise InvalidArgument('other', other, "invalid characters")
- #
append each field
+ #
join the fields
if fullname is not None:
gecos_data = str(fullname)
if fullname is not None:
gecos_data = str(fullname)
- for field in (roomnumber, workphone, homephone, other):
- if field is not None:
- gecos_data += ',' + str(field)
-
- return gecos_data
+ fields = [ fullname, roomnumber, workphone, homephone, other ]
+ for idx in xrange(len(fields), 0, -1):
+ if not fields[idx-1]:
+ fields.pop()
+ else:
+ break
+ while None in fields:
+ fields[fields.index(None)] = ''
+ return ','.join(map(str, fields))
def check_id_nss(ugid):
def check_id_nss(ugid):