]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added __getattr__() proxy to TypeDecorator
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 22 Oct 2006 00:42:43 +0000 (00:42 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 22 Oct 2006 00:42:43 +0000 (00:42 +0000)
lib/sqlalchemy/types.py
test/sql/testtypes.py

index 1a30bc5cd50d8bfe33456aeed8fb381f7adef58f..01c2d18f0b13fb833636eff0ab74a0df6570efe2 100644 (file)
@@ -86,6 +86,9 @@ class TypeDecorator(AbstractType):
             tt.impl = typedesc
             self.impl_dict[dialect] = tt
             return tt
+    def __getattr__(self, key):
+        """proxy all other undefined accessors to the underlying implementation."""
+        return getattr(self.impl, key)
     def get_col_spec(self):
         return self.impl.get_col_spec()
     def convert_bind_param(self, value, dialect):
index db5b2c045d5c62a97b8367e8518e3a16f77605b3..e438b03fb95fe6760a6fd51247aca030f68b5034 100644 (file)
@@ -136,6 +136,7 @@ class UnicodeTest(AssertMixin):
     def tearDownAll(self):
         unicode_table.drop()
     def testbasic(self):
+        assert unicode_table.c.unicode_data.type.length == 250
         rawdata = 'Alors vous imaginez ma surprise, au lever du jour, quand une dr\xc3\xb4le de petit voix m\xe2\x80\x99a r\xc3\xa9veill\xc3\xa9. Elle disait: \xc2\xab S\xe2\x80\x99il vous pla\xc3\xaet\xe2\x80\xa6 dessine-moi un mouton! \xc2\xbb\n'
         unicodedata = rawdata.decode('utf-8')
         unicode_table.insert().execute(unicode_data=unicodedata, plain_data=rawdata)