[Checkins] SVN: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/ added
getMapper() method to MappedClassBase
Andreas Jung
andreas at andreas-jung.com
Sun May 13 07:28:49 EDT 2007
Log message for revision 75712:
added getMapper() method to MappedClassBase
Changed:
U z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt
U z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py
-=-
Modified: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt
===================================================================
--- z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt 2007-05-13 02:50:53 UTC (rev 75711)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt 2007-05-13 11:28:48 UTC (rev 75712)
@@ -1,6 +1,9 @@
1.0.2 (unreleased)
+ - MappedClassBase has a new convinience method getMapper() that returns a
+ mapper class associated through a relation with the current mapper
+
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-13 02:50:53 UTC (rev 75711)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py 2007-05-13 11:28:48 UTC (rev 75712)
@@ -14,7 +14,7 @@
import new
import threading
-from sqlalchemy import Table, mapper, BoundMetaData, relation
+from sqlalchemy import Table, mapper, BoundMetaData, relation, class_mapper
marker = object
@@ -48,7 +48,12 @@
return self.__class__(**d)
+ def getMapper(self, name):
+ """ return a mapper associated with the current mapper """
+ return class_mapper(self.__class__).props[name].mapper.class_
+
+
class MapperFactory(object):
""" a factory for table and mapper objects """
More information about the Checkins
mailing list