summaryrefslogtreecommitdiffstats
path: root/idp/extra/modules/directory.py
diff options
context:
space:
mode:
Diffstat (limited to 'idp/extra/modules/directory.py')
-rw-r--r--idp/extra/modules/directory.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/idp/extra/modules/directory.py b/idp/extra/modules/directory.py
index 5f4717f..a7282b7 100644
--- a/idp/extra/modules/directory.py
+++ b/idp/extra/modules/directory.py
@@ -62,7 +62,10 @@ class Collectivity:
return
new_entry = self.ldap_entry[1].copy()
for attribute in changed:
- new_entry[attribute] = getattr(self, attribute)
+ if attribute in ('cn','postalAddress',):
+ new_entry[attribute] = isotoutf8(getattr(self, attribute))
+ else:
+ new_entry[attribute] = getattr(self, attribute)
if not new_entry[attribute]:
new_entry[attribute] = []
@@ -171,7 +174,7 @@ class Agent:
if type(new_entry[attribute]) is int:
new_entry[attribute] = [str(new_entry[attribute])]
if type(new_entry[attribute]) is str:
- new_entry[attribute] = unicode(new_entry[attribute], 'iso-8859-1').encode('utf-8')
+ new_entry[attribute] = isotoutf8(new_entry[attribute])
if new_entry[attribute] is None:
new_entry[attribute] = []
@@ -185,7 +188,7 @@ class Agent:
raise ldap.ALREADY_EXISTS('cdg59agentSirhCode')
if 'mail' in changed:
- # check for an existing agent with such SIRH code
+ # check for an existing agent with such mail
try:
get_agent_by_email(self.mail)
except KeyError:
@@ -208,7 +211,7 @@ class Agent:
if 'sn' in changed or 'givenName' in changed:
# change common name too
new_entry['cn'] = '%s %s' % (self.givenName, self.sn)
- new_entry['cn'] = unicode(new_entry['cn'], 'iso-8859-1').encode('utf-8')
+ new_entry['cn'] = isotoutf8(new_entry['cn'])
mod_list = ldap.modlist.modifyModlist(self.ldap_entry[1], new_entry)
store = get_store()