# -*- coding: utf-8 -*-
#
# django-ldapdb
-# Copyright (C) 2009 Bolloré telecom
+# Copyright (C) 2009-2010 Bolloré telecom
# See AUTHORS file for a full list of contributors.
#
# This program is free software: you can redistribute it and/or modify
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# -*- coding: utf-8 -*-
-
import ldap
import logging
super(Model, self).__init__(*args, **kwargs)
self.saved_pk = self.pk
+ def _collect_sub_objects(self, collector):
+ """
+ This private API seems to be called by the admin interface in django 1.2
+ """
+ pass
+
def build_rdn(self):
"""
Build the Relative Distinguished Name for this entry.
continue
value = getattr(self, field.name)
if value:
- entry.append((field.db_column, value))
+ entry.append((field.db_column, field.get_db_prep_save(value, connection=ldapdb.connection)))
logging.debug("Creating new LDAP entry %s" % new_dn)
ldapdb.connection.add_s(new_dn, entry)
new_value = getattr(self, field.name, None)
if old_value != new_value:
if new_value:
- modlist.append((ldap.MOD_REPLACE, field.db_column, new_value))
+ modlist.append((ldap.MOD_REPLACE, field.db_column, field.get_db_prep_save(new_value, connection=ldapdb.connection)))
elif old_value:
modlist.append((ldap.MOD_DELETE, field.db_column, None))