[Checkins] SVN: Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/ clean unicode solution

Andreas Jung andreas at andreas-jung.com
Mon Mar 17 17:28:56 EDT 2008


Log message for revision 84751:
  clean unicode solution
  

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

-=-
Modified: Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/da.py
===================================================================
--- Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/da.py	2008-03-17 21:22:53 UTC (rev 84750)
+++ Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/da.py	2008-03-17 21:28:55 UTC (rev 84751)
@@ -269,7 +269,15 @@
         """ perform a query through the ZMI"""
         return self.query(query)
 
-    
+    security.declareProtected(view_management_screens, 'manage_formatItem')
+    def manage_formatItem(self, s):
+        """ used by query form """
+        if isinstance(s, unicode):
+            return s
+        if isinstance(s, str):
+            return unicode(s, self.encoding, 'ignore')
+        return str(s)
+
     security.declareProtected(view_management_screens, 'getVersion')
     def getVersion(self):
         """ return version.txt """

Modified: Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/pt/query.zpt
===================================================================
--- Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/pt/query.zpt	2008-03-17 21:22:53 UTC (rev 84750)
+++ Products.SQLAlchemyDA/trunk/Products/SQLAlchemyDA/pt/query.zpt	2008-03-17 21:28:55 UTC (rev 84751)
@@ -39,7 +39,7 @@
                 <tbody>
                     <tr tal:repeat="row python: result[1]">
                         <td tal:repeat="item row">
-                            <span tal:replace="python: unicode(item, 'iso-8859-15', 'ignore')" tal:on-error="item" />
+                            <span tal:replace="python: context.manage_formatItem(item)" />&nbsp;
                         </td>
                     </tr>
                 </tbody>



More information about the Checkins mailing list