[Checkins] SVN: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/
MappedClassBase: added getMapper(), getMappers()
Andreas Jung
andreas at andreas-jung.com
Sat May 12 04:11:23 EDT 2007
Log message for revision 75696:
MappedClassBase: added getMapper(), getMappers()
Changed:
U z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt
U z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py
U z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/version.txt
-=-
Modified: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt
===================================================================
--- z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt 2007-05-11 22:46:18 UTC (rev 75695)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt 2007-05-12 08:11:19 UTC (rev 75696)
@@ -1,3 +1,8 @@
+1.0.2 (unreleased)
+
+ - MappedClassBase: new convinience methods getMapper(), getMappers()
+
+
1.0.1 (unreleased)
- MappedClassBase: new clone() method
Modified: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py
===================================================================
--- z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py 2007-05-11 22:46:18 UTC (rev 75695)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py 2007-05-12 08:11:19 UTC (rev 75696)
@@ -25,6 +25,8 @@
# Zope 2 security magic.......buuuuuuuhhhhhh
__allow_access_to_unprotected_subobjects__ = 1
+ wrapper = None
+
def __init__(self, **kw):
""" accepts keywords arguments used for initialization of
mapped attributes/columns.
@@ -33,6 +35,24 @@
for k,v in kw.items():
setattr(self, k, v)
+
+ def setWrapper(self, wrapper):
+ """ pass in the wrapper in order to provide the getMapper()
+ functionality directly from a mapper instance.
+ """
+ self.wrapper = wrapper
+
+
+ def getMapper(self, name):
+ """ wrap getMapper() call """
+ return self.wrapper.getMapper(name)
+
+
+ def getMappers(self, *names):
+ """ wrap getMappers() call """
+ return self.wrapper.getMappers(*names)
+
+
def clone(self):
""" Create a pristine copy.
Use this method if you need to reinsert a copy of the current
@@ -149,7 +169,7 @@
# find all dependent tables (referencing the current table)
for table_refname in dependent_table_names:
-
+ import pdb; pdb.set_trace()
# create or get a mapper for the referencing table
table_ref_mapper = self.getMapper(table_refname)
@@ -166,7 +186,9 @@
self._registerMapper(mapper, name)
- return self[name]
+ mapper = self[name]
+ mapper.setWrapper(self.wrapper)
+ return mapper
def _registerMapper(self, mapper, name):
Modified: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/version.txt
===================================================================
--- z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/version.txt 2007-05-11 22:46:18 UTC (rev 75695)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/version.txt 2007-05-12 08:11:19 UTC (rev 75696)
@@ -1 +1 @@
-1.0.1
+1.0.2
More information about the Checkins
mailing list