[Checkins] SVN: z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/m quick&dirty elixir integration

Andreas Jung andreas at andreas-jung.com
Thu May 10 01:58:16 EDT 2007


Log message for revision 75662:
  quick&dirty elixir integration
  

Changed:
  U   z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/mapper.py
  U   z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/model.py

-=-
Modified: z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/mapper.py
===================================================================
--- z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/mapper.py	2007-05-10 05:31:51 UTC (rev 75661)
+++ z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/mapper.py	2007-05-10 05:58:15 UTC (rev 75662)
@@ -91,6 +91,17 @@
     def getMapper(self, name, schema='public'):
         """ return a (cached) mapper class for a given table 'name' """
 
+        if name in self._model.keys():
+            d = self._model[name]
+            print d      
+            if d.has_key('entity'):
+                entity = d['entity']
+                from copy import deepcopy
+                entity2 = deepcopy(entity)
+                self._wrapper.session.bind_mapper(entity2, self._wrapper._engine)
+                return entity2
+        
+
         if not self.has_key(name):
 
             # no-cached data, let's lookup the table ourselfs

Modified: z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/model.py
===================================================================
--- z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/model.py	2007-05-10 05:31:51 UTC (rev 75661)
+++ z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/model.py	2007-05-10 05:58:15 UTC (rev 75662)
@@ -39,7 +39,15 @@
         for d in args:
             self.add(**d)
 
+    def addElixir(self, name, entity):
+        """ Blurb """
 
+        self.names.append(name)
+        self[name] = {'name' : name,
+                      'entity' : entity,
+                     }
+
+
     def add(self, name, table=None, mapper_class=None, relations=None, autodetect_relations=False, table_name=None):
         """ 'name'  -- name of table (no schema support so far!)
 



More information about the Checkins mailing list