Modified:
branches/unhork/grassyknoll/lib/Model.py
branches/unhork/grassyknoll/tests/test_Model.py
Log:
Issue #159: Changed default for __id__ to False.
Modified: branches/unhork/grassyknoll/lib/Model.py
==============================================================================
--- branches/unhork/grassyknoll/lib/Model.py (original)
+++ branches/unhork/grassyknoll/lib/Model.py Wed Jan 7 01:12:32 2009
@@ -144,12 +144,13 @@
Creates multiple schemas from a single definiton, using with-statement
magic
"""
- def __init__(self, __id__=True, **kwargs):
+ def __init__(self, __id__=False, **kwargs):
super(Model, self).__setattr__('__fields__', {})
super(Model, self).__setattr__('_in_with', False)
super(Model, self).__setattr__('__schemas__', kwargs)
- for schema in self.__schemas__.values():
- schema.setIdField()
+ if __id__:
+ for schema in self.__schemas__.values():
+ schema.setIdField()
def __enter__(self):
super(Model, self).__setattr__('_in_with', True)
Modified: branches/unhork/grassyknoll/tests/test_Model.py
==============================================================================
--- branches/unhork/grassyknoll/tests/test_Model.py (original)
+++ branches/unhork/grassyknoll/tests/test_Model.py Wed Jan 7 01:12:32 2009
@@ -201,7 +201,7 @@
def test_Model_with_Object():
norm = Norman.Object()
- with Model(norm = norm) as model:
+ with Model(__id__=True, norm=norm) as model:
assert model.norm is norm
model.size = int
@@ -241,7 +241,7 @@
table = TableMaker.Table("the_table").default(indexed=True)
assert table.newField.indexed == True
- with Model(table = table) as model:
+ with Model(__id__=True, table=table) as model:
# model = model ## XXX fucking wingide
assert model.table is table