[Pypersyst-cvs] pypersyst/pypersyst/entity entity.py,1.60,1.61
Brought to you by:
pobrien
From: Patrick K. O'B. <po...@us...> - 2004-08-11 03:13:28
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/entity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27768/pypersyst/entity Modified Files: entity.py Log Message: Cleaned up the code, removing commented out stuff. Index: entity.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/entity/entity.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** entity.py 11 Aug 2004 02:52:41 -0000 1.60 --- entity.py 11 Aug 2004 03:13:18 -0000 1.61 *************** *** 52,56 **** # Assign some attributes, bypassing __setattr__. self.__dict__['_extent'] = root[self.__class__.__name__] - # self.__dict__['_fields'] = {} # 'field name': field instance self.__dict__['_oid'] = None self.__dict__['_rev'] = 0 # starts at zero and increments by one --- 52,55 ---- *************** *** 68,72 **** # Clean up after ourselves. del self.__dict__['_initattrs'] - fields = {} for name, FieldClass in self._spec: # Make sure they don't try to assign to an attribute we --- 67,70 ---- *************** *** 82,90 **** value = field.default field.set(value) - # fields[name] = field self.__dict__[name] = field.get() # If we got this far, all individual field attrs were valid. ! # self._fields.update(fields) ! # Any remaining attrs are regular instance attributes. for name, value in attrs.iteritems(): self.__dict__[name] = value --- 80,86 ---- value = field.default field.set(value) self.__dict__[name] = field.get() # If we got this far, all individual field attrs were valid. ! # Any remaining attrs are non-field-based instance attributes. for name, value in attrs.iteritems(): self.__dict__[name] = value *************** *** 203,211 **** self.__dict__['_timestampUpdate'] = time self.__dict__['_rev'] += 1 - ## for name, value in attrs.iteritems(): - ## if name in self._fields: - ## self._fields[name].set(value) - ## else: - ## self.__dict__[name] = value fields = self._fields for name, value in attrs.iteritems(): --- 199,202 ---- *************** *** 228,235 **** combined = self._attrs combined.update(attrs) - # XXX Is it really necessary to validate the fields here, - # since setting the value on a field already calls validate? - ## if self._fields: - ## self._validateFields(combined) self._validateAttrs(combined) self._validateEntity(combined) --- 219,222 ---- *************** *** 247,265 **** pass - ## def _validateFields(self, attrs): - ## """Validate the field attrs individually.""" - ## fieldNames = [name for name, fieldClass in self._spec - ## if fieldClass is not None] - ## fields = self._fields - ## for name, value in attrs.iteritems(): - ## # If the attr is a field, validate it individually. - ## if name in fieldNames: - ## # Make sure they don't try to assign to an attribute - ## # we are already using, such as self._oid. - ## if name in self.__dict__: - ## raise AttributeError, '%r is a reserved attribute' % name - ## # Ask the field to validate itself. - ## fields[name].validate(value) - def __int__(self): """Return the oid of the Entity instance.""" --- 234,237 ---- |