diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-27 20:58:13 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-27 20:58:13 -0400 |
| commit | 32e0a1624bf1ae3cb6309062adefd2f5c89b541c (patch) | |
| tree | 3fb898492dd4d825096f69b7d733c49a56695d9a /lib/sqlalchemy/sql | |
| parent | c926f0a9d8910c67554f053ed0f7902542679f0d (diff) | |
| download | sqlalchemy-32e0a1624bf1ae3cb6309062adefd2f5c89b541c.tar.gz | |
import of "sqlalchemy" and "sqlalchemy.orm" works.
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 16 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/functions.py | 17 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/visitors.py | 8 |
3 files changed, 15 insertions, 26 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index e5a2da366..b3f74ceef 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1869,22 +1869,12 @@ class DDLCompiler(engine.Compiled): if column.primary_key: first_pk = True except exc.CompileError as ce: -# start Py3K - raise exc.CompileError("(in table '%s', column '%s'): %s" - % ( + util.raise_from_cause( + exc.CompileError("(in table '%s', column '%s'): %s" % ( table.description, column.name, ce.args[0] - )) from ce -# end Py3K -# start Py2K -# raise exc.CompileError("(in table '%s', column '%s'): %s" -# % ( -# table.description, -# column.name, -# ce.args[0] -# )), None, sys.exc_info()[2] -# end Py2K + ))) const = self.create_table_constraints(table) if const: diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index a2b7ac628..244505bed 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -31,17 +31,18 @@ def register_function(identifier, fn, package="_default"): class _GenericMeta(VisitableType): def __init__(cls, clsname, bases, clsdict): - cls.name = name = clsdict.get('name', clsname) - cls.identifier = identifier = clsdict.get('identifier', name) - package = clsdict.pop('package', '_default') - # legacy - if '__return_type__' in clsdict: - cls.type = clsdict['__return_type__'] - register_function(identifier, cls, package) + if clsname != 'MetaBase': + cls.name = name = clsdict.get('name', clsname) + cls.identifier = identifier = clsdict.get('identifier', name) + package = clsdict.pop('package', '_default') + # legacy + if '__return_type__' in clsdict: + cls.type = clsdict['__return_type__'] + register_function(identifier, cls, package) super(_GenericMeta, cls).__init__(clsname, bases, clsdict) -class GenericFunction(Function, metaclass=_GenericMeta): +class GenericFunction(util.with_metaclass(_GenericMeta, Function)): """Define a 'generic' function. A generic function is a pre-established :class:`.Function` diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index 6efce504a..4d2948462 100644 --- a/lib/sqlalchemy/sql/visitors.py +++ b/lib/sqlalchemy/sql/visitors.py @@ -49,11 +49,9 @@ class VisitableType(type): Classes having no __visit_name__ attribute will remain unaffected. """ def __init__(cls, clsname, bases, clsdict): - if cls.__name__ == 'Visitable' or not hasattr(cls, '__visit_name__'): - super(VisitableType, cls).__init__(clsname, bases, clsdict) - return - - _generate_dispatch(cls) + if clsname not in ('MetaBase', 'Visitable') and \ + hasattr(cls, '__visit_name__'): + _generate_dispatch(cls) super(VisitableType, cls).__init__(clsname, bases, clsdict) |
