|
@@ -70,6 +70,7 @@ class _LeCrud(object):
|
70
|
70
|
raise NotImplementedError("Abstract method") #child classes should return their uid fieldtype
|
71
|
71
|
|
72
|
72
|
## @return A dict with fieldtypes marked as internal
|
|
73
|
+ # @todo check if this method is in use, else delete it
|
73
|
74
|
@classmethod
|
74
|
75
|
def fieldtypes_internal(self):
|
75
|
76
|
return { fname: ft for fname, ft in cls.fieldtypes().items() if hasattr(ft, 'internal') and ft.internal }
|
|
@@ -79,6 +80,15 @@ class _LeCrud(object):
|
79
|
80
|
def fieldlist(cls):
|
80
|
81
|
return cls.fieldtypes().keys()
|
81
|
82
|
|
|
83
|
+ ## @return The name of the uniq id field
|
|
84
|
+ # @todo test for abstract method !!!
|
|
85
|
+ @classmethod
|
|
86
|
+ def uidname(cls):
|
|
87
|
+ if len(cls._uid_fieldtype) == 0:
|
|
88
|
+ raise NotImplementedError("Abstract method uid_name for %s!"%cls.__name__)
|
|
89
|
+ return list(cls._uid_fieldtype.keys())[0]
|
|
90
|
+
|
|
91
|
+
|
82
|
92
|
## @brief Returns object datas
|
83
|
93
|
# @param
|
84
|
94
|
# @return a dict of fieldname : value
|
|
@@ -222,7 +232,7 @@ class _LeCrud(object):
|
222
|
232
|
# @warning assert that the uid is not composed with multiple fieldtypes
|
223
|
233
|
# @return A filter of the form tuple(UID, '=', self.UID)
|
224
|
234
|
def _id_filter(self):
|
225
|
|
- id_name = list(self._uid_fieldtype.keys())[0]
|
|
235
|
+ id_name = self.uidname()
|
226
|
236
|
return ( id_name, '=', getattr(self, id_name) )
|
227
|
237
|
|
228
|
238
|
## @brief Construct datas values
|