[CMF-checkins] SVN: CMF/branches/yuppie-formlib/CMFDefault/ - added
EmailInputWidget
Yvo Schubbe
y.2006_ at wcm-solutions.de
Fri Nov 3 04:10:56 EST 2006
Log message for revision 71039:
- added EmailInputWidget
Changed:
U CMF/branches/yuppie-formlib/CMFDefault/configure.zcml
A CMF/branches/yuppie-formlib/CMFDefault/formlib/configure.zcml
A CMF/branches/yuppie-formlib/CMFDefault/formlib/widgets.py
U CMF/branches/yuppie-formlib/CMFDefault/locales/cmf_default.pot
-=-
Modified: CMF/branches/yuppie-formlib/CMFDefault/configure.zcml
===================================================================
--- CMF/branches/yuppie-formlib/CMFDefault/configure.zcml 2006-11-02 22:14:26 UTC (rev 71038)
+++ CMF/branches/yuppie-formlib/CMFDefault/configure.zcml 2006-11-03 09:10:50 UTC (rev 71039)
@@ -5,6 +5,8 @@
<include package=".browser"/>
+ <include package=".formlib"/>
+
<include file="content.zcml"/>
<include file="profiles.zcml"/>
Added: CMF/branches/yuppie-formlib/CMFDefault/formlib/configure.zcml
===================================================================
--- CMF/branches/yuppie-formlib/CMFDefault/formlib/configure.zcml 2006-11-02 22:14:26 UTC (rev 71038)
+++ CMF/branches/yuppie-formlib/CMFDefault/formlib/configure.zcml 2006-11-03 09:10:50 UTC (rev 71039)
@@ -0,0 +1,9 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope">
+
+ <adapter
+ factory=".widgets.EmailInputWidget"
+ permission="zope.Public"
+ />
+
+</configure>
Property changes on: CMF/branches/yuppie-formlib/CMFDefault/formlib/configure.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: CMF/branches/yuppie-formlib/CMFDefault/formlib/widgets.py
===================================================================
--- CMF/branches/yuppie-formlib/CMFDefault/formlib/widgets.py 2006-11-02 22:14:26 UTC (rev 71038)
+++ CMF/branches/yuppie-formlib/CMFDefault/formlib/widgets.py 2006-11-03 09:10:50 UTC (rev 71039)
@@ -0,0 +1,41 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+#
+# 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.
+#
+##############################################################################
+"""Custom form widgets.
+
+$Id$
+"""
+
+from zope.app.form.browser import TextWidget
+from zope.app.form.interfaces import ConversionError
+from zope.app.form.interfaces import IInputWidget
+from zope.component import adapts
+from zope.interface import implementsOnly
+from zope.publisher.interfaces.browser import IBrowserRequest
+
+from Products.CMFDefault.formlib.schema import IEmailLine
+from Products.CMFDefault.utils import Message as _
+
+
+class EmailInputWidget(TextWidget):
+
+ implementsOnly(IInputWidget)
+ adapts(IEmailLine, IBrowserRequest)
+
+ def _toFieldValue(self, input):
+ if input == self._missing:
+ return self.context.missing_value
+
+ try:
+ return str(input.strip())
+ except (AttributeError, UnicodeEncodeError), err:
+ raise ConversionError(_(u'Invalid email address.'), err)
Property changes on: CMF/branches/yuppie-formlib/CMFDefault/formlib/widgets.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: CMF/branches/yuppie-formlib/CMFDefault/locales/cmf_default.pot
===================================================================
--- CMF/branches/yuppie-formlib/CMFDefault/locales/cmf_default.pot 2006-11-02 22:14:26 UTC (rev 71038)
+++ CMF/branches/yuppie-formlib/CMFDefault/locales/cmf_default.pot 2006-11-03 09:10:50 UTC (rev 71039)
@@ -631,6 +631,7 @@
msgstr ""
#: CMFDefault/exceptions.py:68
+#: CMFDefault/formlib/widgets.py:41
msgid "Invalid email address."
msgstr ""
More information about the CMF-checkins
mailing list