[ressucite] On donne un nouvel id si l'id est déjà pris et on vérifie l'unicité seulement au moment d'enregistrer l'objet
par id j'entends aid, cid, fid, mid, tout ce que apparait dans un dn et qu'on ne peut normalement par modifier tout seul après.
This commit is contained in:
parent
aa573c3c35
commit
007bfeb54e
2 changed files with 26 additions and 17 deletions
10
objets.py
10
objets.py
|
@ -209,13 +209,19 @@ class CransLdapObject(object):
|
|||
if login is None:
|
||||
login = self.conn.current_login
|
||||
self._check_optionnal(comment="créez")
|
||||
|
||||
self.history_add(login, u"Inscription")
|
||||
|
||||
try:
|
||||
if self.conn.search(dn=self.dn):
|
||||
raise ValueError ('objet existant: %s' % self.dn)
|
||||
except ldap.NO_SUCH_OBJECT:
|
||||
pass
|
||||
|
||||
for attr in self.attrs.keys():
|
||||
for attribut in self[attr]:
|
||||
attribut.check_uniqueness([])
|
||||
|
||||
self.history_add(login, u"Inscription")
|
||||
|
||||
# Création de la requête LDAP
|
||||
modlist = addModlist(self._modifs.to_ldif())
|
||||
# Requête LDAP de création de l'objet
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue