[ZCM] [ZC] 2184/ 1 Request "Reference to request.locale in textwidgets.py"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Tue Sep 5 09:31:07 EDT 2006


Issue #2184 Update (Request) "Reference to request.locale in textwidgets.py"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2184

==============================================================
= Request - Entry #1 by Pigletto on Sep 5, 2006 9:31 am

Function __call__ of DateDisplayWidget defined in zope/app/form/browser/textwidgets.py has a reference to request.locale. There is no 'locale' attribute in 'request' in Zope 2.9.x so far, so this code causes AttributeError when trying to use DateDisplayWidget.

Current implementation of __call__:

    def __call__(self):
        if self._renderedValueSet():
            content = self._data
        else:
            content = self.context.default
        if content == self.context.missing_value:
            return ""
        formatter = self.request.locale.dates.getFormatter(
            self._category, (self.displayStyle or None))
        content = formatter.format(content)
        return renderElement("span", contents=escape(content),
                             cssClass=self.cssClass)

Possibly it may be fixed by removing lines:

        formatter = self.request.locale.dates.getFormatter(
            self._category, (self.displayStyle or None))
        content = formatter.format(content)

but I'm not sure whether lack of any locale support here is a proper thing.
==============================================================



More information about the Zope-Collector-Monitor mailing list