[Checkins] SVN: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py the primary_key parameter must be a sequence of Column instances

Andreas Jung andreas at andreas-jung.com
Tue Apr 24 01:20:57 EDT 2007


Log message for revision 74693:
  the primary_key parameter must be a sequence of Column instances
  

Changed:
  U   z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py

-=-
Modified: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py
===================================================================
--- z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py	2007-04-24 04:54:22 UTC (rev 74692)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/mapper.py	2007-04-24 05:20:56 UTC (rev 74693)
@@ -145,6 +145,8 @@
 
             # pre-configured primary_key parameter?
             primary_key = self._model.get(name, {}).get('primary_key')
+            if isinstance(primary_key, (list, tuple)):
+                primary_key = [getattr(table.c, pk) for pk in primary_key]
        
             # create a mapper and cache it 
 



More information about the Checkins mailing list