[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/browser/portal/config.py Duck-typing used to see if value can be decoded.
Charlie Clark
charlie at begeistert.org
Sun Sep 26 16:42:47 EDT 2010
Log message for revision 116957:
Duck-typing used to see if value can be decoded.
Changed:
U Products.CMFDefault/trunk/Products/CMFDefault/browser/portal/config.py
-=-
Modified: Products.CMFDefault/trunk/Products/CMFDefault/browser/portal/config.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/browser/portal/config.py 2010-09-26 18:21:40 UTC (rev 116956)
+++ Products.CMFDefault/trunk/Products/CMFDefault/browser/portal/config.py 2010-09-26 20:42:46 UTC (rev 116957)
@@ -1,3 +1,15 @@
+##############################################################################
+#
+# Copyright (c) 2010 Zope Foundation and Contributors.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
"""Portal Configuration Form"""
from zope.component import adapts, getUtility
@@ -35,8 +47,10 @@
charset = ptool.getProperty('default_charset', None)
for name in getFieldNames(IPortalConfig):
value = ptool.getProperty(name)
- if hasattr(value, 'decode'):
+ try:
value = value.decode(charset)
+ except (AttributeError, UnicodeEncodeError):
+ pass
data[name] = value
data['smtp_server'] = ptool.smtp_server()
self.widgets = form.setUpDataWidgets(
More information about the checkins
mailing list