[Checkins] SVN: Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/ added explicit encoding parameter to passed to engine_options dict

Andreas Jung andreas at andreas-jung.com
Mon Mar 17 17:16:47 EDT 2008


Log message for revision 84749:
  added explicit encoding parameter to passed to engine_options dict
  

Changed:
  U   Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/da.py
  U   Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/pt/addSAWrapperForm.zpt

-=-
Modified: Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/da.py
===================================================================
--- Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/da.py	2008-03-17 20:51:47 UTC (rev 84748)
+++ Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/da.py	2008-03-17 21:16:46 UTC (rev 84749)
@@ -49,6 +49,7 @@
     _properties = (
         {'id' : 'dsn', 'type' : 'string', 'mode' : 'rw', },
         {'id' : 'title', 'type' : 'string', 'mode' : 'rw'}, 
+        {'id' : 'encoding', 'type' : 'string', 'mode' : 'rw'}, 
         {'id' : 'transactional', 'type' : 'boolean', 'mode' : 'rw'}, 
         {'id' : 'quoting_style', 'type' : 'selection', 'mode' : 'rw', 
                  'select_variable' : 'allQuotingStyles'},
@@ -57,6 +58,7 @@
 
     meta_type = 'SQLAlchemyDA '
     dsn = ''
+    encoding = 'iso-8859-15'
     convert_unicode = 0
     transactional = True
     quoting_style = 'standard'
@@ -87,6 +89,7 @@
 
     @property
     def _wrapper(self):
+
         if self.dsn:
             try:
                 return getSAWrapper(self.util_id)
@@ -94,6 +97,8 @@
                 return createSAWrapper(self.dsn, 
                                        forZope=True, 
                                        transactional=self.transactional,
+                                       engine_options={'convert_unicode' : self.convert_unicode,
+                                                       'encoding' : self.encoding},
                                        name=self.util_id)
         return None
 
@@ -305,12 +310,14 @@
 
 
 
-def manage_addSAWrapper(self, id, dsn, title, convert_unicode=0, RESPONSE=None):
+def manage_addSAWrapper(self, id, dsn, title, encoding='iso-8859-15', 
+                        convert_unicode=0, RESPONSE=None):
     """ create a new SAWrapper instance """
     
     wrapper = SAWrapper(id, title)
     wrapper.dsn = dsn
     wrapper.convert_unicode = convert_unicode
+    wrapper.encoding = encoding 
     self._setObject(id, wrapper.__of__(self))
     if RESPONSE:
         return RESPONSE.redirect(self._getOb(id).absolute_url() + '/manage_workspace')

Modified: Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/pt/addSAWrapperForm.zpt
===================================================================
--- Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/pt/addSAWrapperForm.zpt	2008-03-17 20:51:47 UTC (rev 84748)
+++ Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/pt/addSAWrapperForm.zpt	2008-03-17 21:16:46 UTC (rev 84749)
@@ -49,6 +49,21 @@
   <tr>
     <td>
     <div class="form-label">
+    Encoding
+    </div>
+    </td>
+    <td>
+      <input type="text" name="encoding" size="40" value="iso-8859-15"/>
+      <em>Encoding of your database</em>
+      <br/>
+      Ensure that the underlying database supports transactions!
+    </td>
+  </tr>
+
+
+  <tr>
+    <td>
+    <div class="form-label">
     Convert to unicode
     </div>
     </td>



More information about the Checkins mailing list