|
@@ -40,16 +40,16 @@ class EmComponent(object):
|
40
|
40
|
elif isinstance(id_or_name, str):
|
41
|
41
|
self.uid = None
|
42
|
42
|
self.name = id_or_name
|
43
|
|
- self.populate()
|
44
|
43
|
else:
|
45
|
44
|
raise TypeError('Bad argument: expecting <int> or <str> but got : '+str(type(id_or_name)))
|
|
45
|
+ self.populate()
|
46
|
46
|
|
47
|
47
|
# access values of data fields from the object properties
|
48
|
48
|
def __getattr__(self, name):
|
49
|
49
|
if name != '_fields' and name in self._fields:
|
50
|
50
|
return self._fields[name].value
|
51
|
51
|
|
52
|
|
- raise AttributeError
|
|
52
|
+ raise AttributeError('Error unknown attribute : '+name)
|
53
|
53
|
|
54
|
54
|
# set values of data fields from the object properties
|
55
|
55
|
def __setattr__(self, name, value):
|
|
@@ -118,9 +118,6 @@ class EmComponent(object):
|
118
|
118
|
@return bool
|
119
|
119
|
"""
|
120
|
120
|
def save(self):
|
121
|
|
- if self.name id None:
|
122
|
|
- self.populate()
|
123
|
|
-
|
124
|
121
|
values = {}
|
125
|
122
|
for name, field in self._fields.items():
|
126
|
123
|
values[name] = field.to_sql()
|