]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixed a nasty import hack and removed AbstractType.get_search_list().
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Jul 2009 18:42:41 +0000 (18:42 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Jul 2009 18:42:41 +0000 (18:42 +0000)
06CHANGES
lib/sqlalchemy/__init__.py
lib/sqlalchemy/dialects/oracle/cx_oracle.py
lib/sqlalchemy/sql/expression.py
lib/sqlalchemy/types.py

index 13b233fc8f22a980bde18dc05b0afd6919c28ba0..a726ec22aa3cb979445cb5bebb40e9da34bb7f02 100644 (file)
--- a/06CHANGES
+++ b/06CHANGES
       of mutable=True) if __eq__() is not overridden or a comparison function is not provided.
     - The default "precision" and "scale" arguments of Numeric and Float have been removed 
       and now default to None.   NUMERIC and FLOAT will be rendered with no numeric arguments
-      by default unless these values are provided.
\ No newline at end of file
+      by default unless these values are provided.
+    - AbstractType.get_search_list() is removed - the games that was used for are no 
+      longer necessary.
+      
+      
\ No newline at end of file
index 1b1b96855772312b8bb418f39b19151ffee79cc9..31469ee5ae45e186334aa1291948e59326e030fb 100644 (file)
@@ -10,42 +10,6 @@ import sys
 import sqlalchemy.exc as exceptions
 sys.modules['sqlalchemy.exceptions'] = exceptions
 
-from sqlalchemy.types import (
-    BLOB,
-    BOOLEAN,
-    Binary,
-    Boolean,
-    CHAR,
-    CLOB,
-    DATE,
-    DATETIME,
-    DECIMAL,
-    Date,
-    DateTime,
-    FLOAT,
-    Float,
-    INT,
-    INTEGER,
-    Integer,
-    Interval,
-    NCHAR,
-    NVARCHAR,
-    NUMERIC,
-    Numeric,
-    PickleType,
-    SMALLINT,
-    SmallInteger,
-    String,
-    TEXT,
-    TIME,
-    TIMESTAMP,
-    Text,
-    Time,
-    Unicode,
-    UnicodeText,
-    VARCHAR,
-    )
-
 from sqlalchemy.sql import (
     alias,
     and_,
@@ -83,6 +47,43 @@ from sqlalchemy.sql import (
     update,
     )
 
+from sqlalchemy.types import (
+    BLOB,
+    BOOLEAN,
+    Binary,
+    Boolean,
+    CHAR,
+    CLOB,
+    DATE,
+    DATETIME,
+    DECIMAL,
+    Date,
+    DateTime,
+    FLOAT,
+    Float,
+    INT,
+    INTEGER,
+    Integer,
+    Interval,
+    NCHAR,
+    NVARCHAR,
+    NUMERIC,
+    Numeric,
+    PickleType,
+    SMALLINT,
+    SmallInteger,
+    String,
+    TEXT,
+    TIME,
+    TIMESTAMP,
+    Text,
+    Time,
+    Unicode,
+    UnicodeText,
+    VARCHAR,
+    )
+
+
 from sqlalchemy.schema import (
     CheckConstraint,
     Column,
index fb5662bd12167329c8658a424a2f6398e1a3a274..60d80e811bc7161420efceba4da1495d0e0580e1 100644 (file)
@@ -157,6 +157,7 @@ colspecs = {
     sqltypes.Text : OracleText,
     sqltypes.UnicodeText : OracleUnicodeText,
     sqltypes.TIMESTAMP : OracleTimestamp,
+    OracleRaw: cxOracleRaw,
 }
 
 class Oracle_cx_oracleExecutionContext(DefaultExecutionContext):
index 3d212df7a3c15f41e162b9b4d271e88a1105a592..519c2cacc39da6271aff71453dc9f2160fc48357 100644 (file)
@@ -29,12 +29,12 @@ to stay the same in future releases.
 import itertools, re
 from operator import attrgetter
 
-from sqlalchemy import util, exc
+from sqlalchemy import util, exc, types as sqltypes
 from sqlalchemy.sql import operators
 from sqlalchemy.sql.visitors import Visitable, cloned_traverse
 import operator
 
-functions, schema, sql_util, sqltypes = None, None, None, None
+functions, schema, sql_util = None, None, None
 DefaultDialect, ClauseAdapter, Annotated = None, None, None
 
 __all__ = [
index 5162cc53b5f2731cf14a0a594872ccbf8c371122..ff7e4667825502a5f328e55a226755ccc942455d 100644 (file)
@@ -28,9 +28,6 @@ from decimal import Decimal as _python_Decimal
 from sqlalchemy import exc
 from sqlalchemy.util import pickle
 from sqlalchemy.sql.visitors import Visitable
-from sqlalchemy.sql import expression
-import sys
-expression.sqltypes = sys.modules[__name__]
 import sqlalchemy.util as util
 NoneType = type(None)
     
@@ -89,14 +86,6 @@ class AbstractType(Visitable):
         """
         return op
 
-    def get_search_list(self):
-        """return a list of classes to test for a match
-        when adapting this type to a dialect-specific type.
-
-        """
-
-        return self.__class__.__mro__[0:-1]
-
     def __repr__(self):
         return "%s(%s)" % (
             self.__class__.__name__,
@@ -106,18 +95,19 @@ class AbstractType(Visitable):
 class TypeEngine(AbstractType):
     """Base for built-in types."""
 
+    @util.memoized_property
+    def _impl_dict(self):
+        return {}
+        
     def dialect_impl(self, dialect, **kwargs):
         try:
             return self._impl_dict[dialect.__class__]
-        except AttributeError:
-            self._impl_dict = {}
-            return self._impl_dict.setdefault(dialect.__class__, dialect.__class__.type_descriptor(self))
         except KeyError:
             return self._impl_dict.setdefault(dialect.__class__, dialect.__class__.type_descriptor(self))
 
     def __getstate__(self):
         d = self.__dict__.copy()
-        d['_impl_dict'] = {}
+        d.pop('_impl_dict', None)
         return d
 
     def bind_processor(self, dialect):
@@ -227,7 +217,8 @@ class TypeDecorator(AbstractType):
     
     def __init__(self, *args, **kwargs):
         if not hasattr(self.__class__, 'impl'):
-            raise AssertionError("TypeDecorator implementations require a class-level variable 'impl' which refers to the class of type being decorated")
+            raise AssertionError("TypeDecorator implementations require a class-level "
+                        "variable 'impl' which refers to the class of type being decorated")
         self.impl = self.__class__.impl(*args, **kwargs)
 
     def dialect_impl(self, dialect):
@@ -365,7 +356,7 @@ def to_instance(typeobj):
 def adapt_type(typeobj, colspecs):
     if isinstance(typeobj, type):
         typeobj = typeobj()
-    for t in typeobj.get_search_list():
+    for t in typeobj.__class__.__mro__[0:-1]:
         try:
             impltype = colspecs[t]
             break