[Commits] (stearns) Fix the hack that was trying to ensure that item bodies are ASCII; it was assuming we'd get non-unicode back from the widget.

commits at osafoundation.org commits at osafoundation.org
Tue Apr 12 15:04:26 PDT 2005


Commit by: stearns
Modified files:
chandler/parcels/osaf/framework/blocks/detail/Detail.py 1.111 1.112

Log message:
Fix the hack that was trying to ensure that item bodies are ASCII; it was assuming we'd get non-unicode back from the widget.
Fixes bugs 2828, 2831, 2830

Bugzilla links:
http://bugzilla.osafoundation.org/show_bug.cgi?id=2828
http://bugzilla.osafoundation.org/show_bug.cgi?id=2831
http://bugzilla.osafoundation.org/show_bug.cgi?id=2830

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/detail/Detail.py.diff?r1=text&tr1=1.111&r2=text&tr2=1.112

Index: chandler/parcels/osaf/framework/blocks/detail/Detail.py
diff -u chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.111 chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.112
--- chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.111	Thu Apr  7 12:51:51 2005
+++ chandler/parcels/osaf/framework/blocks/detail/Detail.py	Tue Apr 12 15:04:24 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.111 $"
-__date__ = "$Date: 2005/04/07 19:51:51 $"
+__version__ = "$Revision: 1.112 $"
+__date__ = "$Date: 2005/04/12 22:04:24 $"
 __copyright__ = "Copyright (c) 2004-2005 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -735,7 +735,9 @@
                 #XXX: Ensures that any non-ascii text entered in to the detail view
                 #     is properly encoded to ascii. This is a short term fix
                 #     and will not address issues related to internationalization
-                text = unicode(widgetText, 'utf-8', 'ignore').encode('ascii', 'ignore')
+                if not isinstance(widgetText, unicode):
+                    widgetText = unicode(widgetText, 'utf-8', 'ignore')
+                text = widgetText.encode('ascii', 'ignore')
                 item.body = textType.makeValue(text, encoding='ascii', indexed=True)
         
     def loadAttributeIntoWidget (self, item, widget):  



More information about the Commits mailing list