[Checkins] SVN: z3c.sqlalchemy/branches/declarative-integration/src/z3c/sqlalchemy/ - several integration fixes

Andreas Jung andreas at andreas-jung.com
Mon Jun 2 11:00:31 EDT 2008


Log message for revision 87108:
  - several integration fixes
  - disabled subclass check
  

Changed:
  U   z3c.sqlalchemy/branches/declarative-integration/src/z3c/sqlalchemy/model.py
  U   z3c.sqlalchemy/branches/declarative-integration/src/z3c/sqlalchemy/tests/testSQLAlchemy.py

-=-
Modified: z3c.sqlalchemy/branches/declarative-integration/src/z3c/sqlalchemy/model.py
===================================================================
--- z3c.sqlalchemy/branches/declarative-integration/src/z3c/sqlalchemy/model.py	2008-06-02 14:56:25 UTC (rev 87107)
+++ z3c.sqlalchemy/branches/declarative-integration/src/z3c/sqlalchemy/model.py	2008-06-02 15:00:31 UTC (rev 87108)
@@ -56,16 +56,17 @@
 
             'table_name' -- optional full name of a table (e.g. 'someschema.sometable') if
             you want to use 'name' as alias for the table.
-        
+
             'cascade' -- optional cascade parameter directly passed to the relation() call
         """
 
         if table is not None and not isinstance(table, sqlalchemy.Table):
             raise TypeError("'table' must be an instance or sqlalchemy.Table or None")
 
-        if mapper_class is not None and not issubclass(mapper_class, MappedClassBase):
-            raise TypeError("'mapper_class' must be a subclass of MappedClassBase")
-        
+        # sqlalchemy.ext.declarative can be used on _any_ base class
+#        if mapper_class is not None and not issubclass(mapper_class, MappedClassBase):
+#            raise TypeError("'mapper_class' must be a subclass of MappedClassBase")
+
         if relations is not None:
 
             if not isinstance(relations, (tuple, list)):

Modified: z3c.sqlalchemy/branches/declarative-integration/src/z3c/sqlalchemy/tests/testSQLAlchemy.py
===================================================================
--- z3c.sqlalchemy/branches/declarative-integration/src/z3c/sqlalchemy/tests/testSQLAlchemy.py	2008-06-02 14:56:25 UTC (rev 87107)
+++ z3c.sqlalchemy/branches/declarative-integration/src/z3c/sqlalchemy/tests/testSQLAlchemy.py	2008-06-02 15:00:31 UTC (rev 87108)
@@ -93,15 +93,15 @@
         self.assertEqual(User, myUser)
 
 
-    def testCustomMapperClassWithWrongType(self):
+#    def testCustomMapperClassWithWrongType(self):
+#
+#        class myUser(object): 
+#            pass
+#
+#        M = Model()
+#        self.assertRaises(TypeError, M.add, 'users', mapper_class=myUser)
 
-        class myUser(object): 
-            pass
 
-        M = Model()
-        self.assertRaises(TypeError, M.add, 'users', mapper_class=myUser)
-
-
     def testGetMappers(self):
 
         db = createSAWrapper(self.dsn)



More information about the Checkins mailing list