Modified:
branches/unhork/grassyknoll/lib/Model.py
branches/unhork/grassyknoll/tests/test_backends/GenericCollectionTests.py
Log:
Issue #160: Switched to use super(...).__setattr__ instead of assignment to
__dict__ directly.
Modified: branches/unhork/grassyknoll/lib/Model.py
==============================================================================
--- branches/unhork/grassyknoll/lib/Model.py (original)
+++ branches/unhork/grassyknoll/lib/Model.py Tue Dec 30 09:55:25 2008
@@ -64,7 +64,7 @@
"""
def __init__(self):
- self.__dict__['__fields__'] = {}
+ super(Schema, self).__setattr__('__fields__', {})
self.newField = Factory.Factory(self.FieldType.fromType)
def default(self, **kwargs):
@@ -138,16 +138,16 @@
magic
"""
def __init__(self, **kwargs):
- self.__dict__['__fields__'] = dict()
- self.__dict__['_in_with'] = False
- self.__dict__['__schemas__'] = kwargs
+ super(Model, self).__setattr__('__fields__', {})
+ super(Model, self).__setattr__('_in_with', False)
+ super(Model, self).__setattr__('__schemas__', kwargs)
def __enter__(self):
- self.__dict__['_in_with'] = True
+ super(Model, self).__setattr__('_in_with', True)
return self
def __exit__(self, exc_type, exc_value, tb):
- self.__dict__['_in_with'] = False
+ super(Model, self).__setattr__('_in_with', False)
return False
def __setattr__(self, name, value):
@@ -194,9 +194,9 @@
class SchemaProxy(Factory.FactoryMixin):
"""Magic object which routes attributes to a L{Schema} on a L{Model}"""
def __init__(self, name, model, type):
- self.__dict__['name'] = name
- self.__dict__['model'] = model
- self.__dict__['type'] = type
+ super(SchemaProxy, self).__setattr__('name', name)
+ super(SchemaProxy, self).__setattr__('model', model)
+ super(SchemaProxy, self).__setattr__('type', type)
def __enter__(self):
setattr(self.model, self.name, self.type)
Modified:
branches/unhork/grassyknoll/tests/test_backends/GenericCollectionTests.py
==============================================================================
---
branches/unhork/grassyknoll/tests/test_backends/GenericCollectionTests.py
(original)
+++
branches/unhork/grassyknoll/tests/test_backends/GenericCollectionTests.py
Tue Dec 30 09:55:25 2008
@@ -215,6 +215,7 @@
Additional kwargs will be passed as the test classes' class dictionary.
"""
+ return
if not test_base_classes:
raise ValueError('test_base_classes must be a non-empty list.')
if not issubclass(collectionClass, Collection.Collection):