Commits

Gael Pasgrimaud  committed 1d8db61

fix group property and invoice reference

  • Participants
  • Parent commits 85a3de3

Comments (0)

Files changed (2)

File afpy/ldap/custom.py

     paymentDate = schema.DateProperty('paymentDate', title='Date', required=True)
     paymentObject = schema.StringProperty('paymentObject', title='Type', required=True)
     paymentAmount = schema.IntegerProperty('paymentAmount', title='Montant', required=True)
-    invoiceReference = schema.StringProperty('invoiceReference', title='Reference')
+    invoiceReference = schema.UnicodeProperty('invoiceReference', title='Reference')
 
 class User(BaseUser):
     """

File afpy/ldap/schema.py

         return getattr(instance.conn, '%s_class' % self._item_class)
 
     def get_instances(self, instance):
+        value = []
         item_class = self.item_class(instance)
-        value = instance.conn.get_groups(instance.dn,
-                                         base_dn=item_class.base_dn,
-                                         node_class=item_class)
+        if instance.conn and item_class.base_dn:
+            value = instance.conn.get_groups(instance._dn,
+                                             base_dn=item_class.base_dn,
+                                             node_class=item_class)
         return value
 
     def __get__(self, instance, klass):
             return self
         if not instance.conn:
             return self.klass()
-        item_class = self.item_class(instance)
         return self._to_python(self.get_instances(instance))
 
     def __set__(self, instance, value):