[Checkins] SVN: z3c.zalchemy/trunk/src/z3c/zalchemy/ Actually, the DSN is a URI field, so the Unicode issue goes away...

Stefan H. Holek stefan at epy.co.at
Thu Mar 1 12:12:45 EST 2007


Log message for revision 72949:
  Actually, the DSN is a URI field, so the Unicode issue goes away...
  

Changed:
  U   z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py
  U   z3c.zalchemy/trunk/src/z3c/zalchemy/interfaces.py
  U   z3c.zalchemy/trunk/src/z3c/zalchemy/tests/test_directives.py

-=-
Modified: z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py
===================================================================
--- z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py	2007-03-01 16:44:59 UTC (rev 72948)
+++ z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py	2007-03-01 17:12:44 UTC (rev 72949)
@@ -34,9 +34,6 @@
 
     def __init__(self, name, dsn, echo=False, encoding='utf-8', convert_unicode=False, **kwargs):
         self.name = name
-        # BBB: DSN is a field now and requires unicode
-        if isinstance(dsn, str):
-            dsn = unicode(dsn, errors='ignore')
         self.dsn = dsn
         self.encoding = encoding
         self.convert_unicode = convert_unicode

Modified: z3c.zalchemy/trunk/src/z3c/zalchemy/interfaces.py
===================================================================
--- z3c.zalchemy/trunk/src/z3c/zalchemy/interfaces.py	2007-03-01 16:44:59 UTC (rev 72948)
+++ z3c.zalchemy/trunk/src/z3c/zalchemy/interfaces.py	2007-03-01 17:12:44 UTC (rev 72949)
@@ -39,10 +39,10 @@
 
 
 class IAlchemyEngineUtility(interface.Interface):
-    dsn = schema.TextLine(
+    dsn = schema.URI(
             title=u'DSN',
             required=True,
-            default=u'sqlite://',
+            default='sqlite://',
             )
     encoding = schema.BytesLine(
             title=u'Encoding',

Modified: z3c.zalchemy/trunk/src/z3c/zalchemy/tests/test_directives.py
===================================================================
--- z3c.zalchemy/trunk/src/z3c/zalchemy/tests/test_directives.py	2007-03-01 16:44:59 UTC (rev 72948)
+++ z3c.zalchemy/trunk/src/z3c/zalchemy/tests/test_directives.py	2007-03-01 17:12:44 UTC (rev 72949)
@@ -49,7 +49,7 @@
             )))
         util = component.getUtility(IAlchemyEngineUtility)
         self.assertNotEqual(util, None)
-        self.assertEqual(util.dsn, u'sqlite://testdatabase.db')
+        self.assertEqual(util.dsn, 'sqlite://testdatabase.db')
         self.assertEqual(util.echo, True)
 
     def testEngineDirective(self):
@@ -64,7 +64,7 @@
             )))
         util = component.getUtility(IAlchemyEngineUtility,'sqlite')
         self.assertNotEqual(util, None)
-        self.assertEqual(util.dsn, u'sqlite://testdatabase.db')
+        self.assertEqual(util.dsn, 'sqlite://testdatabase.db')
         self.assertEqual(util.echo, True)
 
     def testConnectDirective(self):



More information about the Checkins mailing list