]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
tweak...
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 31 Mar 2006 07:29:28 +0000 (07:29 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 31 Mar 2006 07:29:28 +0000 (07:29 +0000)
lib/sqlalchemy/mapping/mapper.py
lib/sqlalchemy/mods/selectresults.py

index 9d2286eb0545db6207eb3130a35d5e6ae42fc778..0f2b4e19f71c51f3b4f21eb575455d9e4f2a4ad4 100644 (file)
@@ -19,8 +19,8 @@ import weakref
 # a dictionary mapping classes to their primary mappers
 mapper_registry = weakref.WeakKeyDictionary()
 
-# a list of MapperExtensions that will be installed by default
-extensions = []
+# a list of MapperExtensions that will be installed in all mappers by default
+global_extensions = []
 
 # a constant returned by _getattrbycolumn to indicate
 # this mapper is not handling an attribute for a particular
@@ -56,13 +56,13 @@ class Mapper(object):
         
         ext = MapperExtension()
         
-        for ext_class in extensions:
+        for ext_class in global_extensions:
             ext = ext_class().chain(ext)
+        
+        for ext_obj in util.to_list(extension):
+            ext = ext_obj.chain(ext)
             
-        if extension is not None:
-            self.extension = extension.chain(ext)
-        else:
-            self.extension = ext
+        self.extension = ext
 
         self.class_ = class_
         self.is_primary = is_primary
index 9613d8fc0f2909037f7ceccaf97653961753ee13..1f6b77a25cf4f2ed83d6f957f98fb706938bad76 100644 (file)
@@ -3,7 +3,7 @@ import sqlalchemy.sql as sql
 import sqlalchemy.mapping as mapping
 
 def install_plugin():
-    mapping.extensions.append(SelectResultsExt)
+    mapping.global_extensions.append(SelectResultsExt)
     
 class SelectResultsExt(mapping.MapperExtension):
     def select_by(self, mapper, *args, **params):