products/CPSonFive.old

changeset 41:c2875899a5b6 CPS-3.4.1

Fixed untranslated widget errors.
author lregebro
date Thu, 18 May 2006 12:13:48 +0000
parents 8372165fef22
children 777767a9bb61
files CHANGES form/overrides.zcml form/widget.py form/widget_macros.pt
diffstat 4 files changed, 3 insertions(+), 30 deletions(-) [+]
line diff
     1.1 --- a/CHANGES
     1.2 +++ b/CHANGES
     1.3 @@ -8,7 +8,8 @@
     1.4    workspaces and sections.
     1.5  Bug fixes:
     1.6  ~~~~~~~~~~
     1.7 --
     1.8 +- 0004430: With the upgrade to Zope3 style i18n, the Widget error override 
     1.9 +  ment that widget errors didn't get translated if they were Messages.
    1.10  New internal features:
    1.11  ~~~~~~~~~~~~~~~~~~~~~~
    1.12  - Calling the Document Navigation method "getCalendarNavigation" didn't
     2.1 --- a/form/overrides.zcml
     2.2 +++ b/form/overrides.zcml
     2.3 @@ -10,12 +10,4 @@
     2.4      permission="zope.Public"
     2.5      />
     2.6  
     2.7 -  <view
     2.8 -    type="zope.publisher.interfaces.browser.IBrowserRequest"
     2.9 -    for="zope.app.form.interfaces.IWidgetInputError"
    2.10 -    provides="zope.app.form.browser.interfaces.IWidgetInputErrorView"
    2.11 -    factory="Products.CPSonFive.form.widget.CPSWidgetInputErrorView"
    2.12 -    permission="zope.Public"
    2.13 -    />
    2.14 -
    2.15  </configure>
     3.1 --- a/form/widget.py
     3.2 +++ b/form/widget.py
     3.3 @@ -31,22 +31,6 @@
     3.4      from zope.i18nmessageid import MessageIDFactory as MessageFactory
     3.5  _ = MessageFactory("Default")
     3.6  
     3.7 -class CPSWidgetInputErrorView(WidgetInputErrorView):
     3.8 -    """Display an input error as a snippet of text.
     3.9 -
    3.10 -    In Zope 3.0.0, error messages are wrapped in double <span class="error"> 
    3.11 -    tags. This is ugly and complicates translation. We replace these with
    3.12 -    our own error messages that are unwrapped. Another possibility would be 
    3.13 -    to translate them inside this view. That would give us the possibility
    3.14 -    to have different CSS classes for different errors, but we don't need
    3.15 -    that at the moment.
    3.16 -    """
    3.17 -
    3.18 -    def snippet(self):
    3.19 -        """Convert a widget input error to an html snippet"""
    3.20 -        return escape(self.context.doc())
    3.21 -
    3.22 -
    3.23  class DocumentBrowserWidget(TextWidget):
    3.24  
    3.25      displayWidth = 30
     4.1 --- a/form/widget_macros.pt
     4.2 +++ b/form/widget_macros.pt
     4.3 @@ -9,11 +9,7 @@
     4.4        </div>
     4.5        <div class="field">
     4.6          <tal:block tal:content="structure widget"/>
     4.7 -        <span tal:define="error widget/error" class="error"
     4.8 -          tal:condition="error" tal:content="error"
     4.9 -          i18n:translate="" >
    4.10 -          The Error
    4.11 -        </span>
    4.12 +        <tal:block tal:content="structure widget/error"/>
    4.13        </div>
    4.14      </metal:block>
    4.15    </div>