the absense of which was preventing the new
GAE dialect from being loaded. [ticket:2529]
+ - [bug] Fixed the repr() of Enum to include
+ the "name" and "native_enum" flags. Helps
+ Alembic autogenerate.
+
0.7.8
=====
- orm
"""
self.enums = enums
self.native_enum = kw.pop('native_enum', True)
- convert_unicode= kw.pop('convert_unicode', None)
+ convert_unicode = kw.pop('convert_unicode', None)
if convert_unicode is None:
for e in enums:
if isinstance(e, unicode):
convert_unicode = False
if self.enums:
- length =max(len(x) for x in self.enums)
+ length = max(len(x) for x in self.enums)
else:
length = 0
String.__init__(self,
- length =length,
+ length=length,
convert_unicode=convert_unicode,
)
SchemaType.__init__(self, **kw)
+ def __repr__(self):
+ return util.generic_repr(self, [
+ ("native_enum", True),
+ ("name", None)
+ ])
+
def _should_create_constraint(self, compiler):
return not self.native_enum or \
not compiler.dialect.supports_native_enum
else:
return func_or_cls
-def generic_repr(obj):
+def generic_repr(obj, additional_kw=()):
"""Produce a __repr__() based on direct association of the __init__()
specification vs. same-named attributes present.
yield '%s=%r' % (arg, val)
except:
pass
+ if additional_kw:
+ for arg, defval in additional_kw:
+ try:
+ val = getattr(obj, arg, None)
+ if val != defval:
+ yield '%s=%r' % (arg, val)
+ except:
+ pass
+
return "%s(%s)" % (obj.__class__.__name__, ", ".join(genargs()))
class portable_instancemethod(object):