[lc_ldap] create et save vérifient que les attributs non optionnels sont fournis
This commit is contained in:
parent
180c17baed
commit
8ce84e7589
1 changed files with 15 additions and 0 deletions
15
lc_ldap.py
15
lc_ldap.py
|
@ -529,6 +529,13 @@ class CransLdapObject(object):
|
|||
"""Crée l'objet dans la base ldap, cette méthode vise à faire en sorte que
|
||||
l'objet se crée lui-même, si celui qui essaye de le modifier a les droits
|
||||
de le faire."""
|
||||
objet = self.__class__.__name__
|
||||
|
||||
for attribut in self.attribs:
|
||||
if not attribut.optional:
|
||||
nom_attr = attribut.__name__
|
||||
if len(self._modifs.get(nom_attr, [])) <= 0:
|
||||
raise attributs.OptionalError("L'objet %s que vous créez doit posséder au moins un attribut %s" % (objet, nom_attr))
|
||||
|
||||
# Création de la requête LDAP
|
||||
modlist = addModlist(cldif_to_ldif(self._modifs))
|
||||
|
@ -542,6 +549,14 @@ class CransLdapObject(object):
|
|||
if self.mode not in ['w', 'rw']:
|
||||
raise EnvironmentError("Objet en lecture seule, réessayer en lecture/écriture")
|
||||
|
||||
objet = self.__class__.__name__
|
||||
|
||||
for attribut in self.attribs:
|
||||
if not attribut.optional:
|
||||
nom_attr = attribut.__name__
|
||||
if len(self._modifs.get(nom_attr, [])) <= 0:
|
||||
raise attributs.OptionalError("L'objet %s que vous créez doit posséder au moins un attribut %s" % (objet, nom_attr))
|
||||
|
||||
# On récupère la liste des modifications
|
||||
modlist = self.get_modlist()
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue