[Checkins]
SVN: z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/mapper.py
Elixir support cleanup
Andreas Jung
andreas at andreas-jung.com
Thu May 10 02:28:09 EDT 2007
Log message for revision 75665:
Elixir support cleanup
Changed:
U z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/mapper.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 06:23:39 UTC (rev 75664)
+++ z3c.sqlalchemy/branches/elixir-integration/src/z3c/sqlalchemy/mapper.py 2007-05-10 06:28:08 UTC (rev 75665)
@@ -12,6 +12,7 @@
"""
import new
+from copy import deepcopy
import threading
from sqlalchemy import Table, mapper, BoundMetaData, relation
@@ -91,15 +92,12 @@
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]
- 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
-
+ # Elixir support first
+ entity = self._model.get(name, {}).get('entity')
+ if entity:
+ entity2 = deepcopy(entity)
+ self._wrapper.session.bind_mapper(entity2, self._wrapper._engine)
+ return entity2
if not self.has_key(name):
More information about the Checkins
mailing list