X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fdjango-ldapdb.git;a=blobdiff_plain;f=ldapdb%2Fmodels%2Fbase.py;h=41d00e8c684b3fa7483973a5478b888808cce290;hp=363ae92fcfb912cbb2b623c876ee328a9e139680;hb=c15d0f62f8b92e9a2c69d9b93ded4cf964ef710c;hpb=df8e8b0b5fb5d56de5b6138d2f21c70aab612730 diff --git a/ldapdb/models/base.py b/ldapdb/models/base.py index 363ae92..41d00e8 100644 --- a/ldapdb/models/base.py +++ b/ldapdb/models/base.py @@ -1,7 +1,7 @@ # -*- 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 @@ -60,6 +60,12 @@ class Model(django.db.models.base.Model): 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. @@ -99,7 +105,7 @@ class Model(django.db.models.base.Model): 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) @@ -119,7 +125,7 @@ class Model(django.db.models.base.Model): 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))