Log message for revision 79698:
The ZPublisher HTTP request has now both the debug and locale attributes
available, like its Zope 3 counterpart, as discussed in
http://mail.zope.org/pipermail/zope-dev/2007-September/029719.html.
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/Products/Five/form/__init__.py
U Zope/trunk/lib/python/Products/Five/formlib/formbase.py
U Zope/trunk/lib/python/ZPublisher/HTTPRequest.py
U Zope/trunk/lib/python/ZPublisher/tests/testHTTPRequest.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt 2007-09-16 16:54:06 UTC (rev 79697)
+++ Zope/trunk/doc/CHANGES.txt 2007-09-16 17:15:42 UTC (rev 79698)
@@ -69,6 +69,15 @@
Features added
+ - The ZPublisher HTTP request has now both the debug and locale
+attributes available, like its Zope 3 counterpart. The debug attribute
+was so far limited to code from the zope.* namespace in order to make
+the Zope 3 ZPT engine work. The locale attribute provides access to an
+zope.i18n.interfaces.locales.ILocale object with access to locale
+related information like date / time formatting or translated language
+and country names. Form variables of both debug and locale will shadow
+these two attributes and their use is therefor discouraged.
+
- MailHost: now uses zope.sendmail for delivering the mail. With this
change
MailHost integrates with the Zope transaction system (avoids sending
dupe
emails in case of conflict errors). In addition MailHost now provides
Modified: Zope/trunk/lib/python/Products/Five/form/__init__.py
===
--- Zope/trunk/lib/python/Products/Five/form/__init__.py2007-09-16
16:54:06 UTC (rev 79697)
+++ Zope/trunk/lib/python/Products/Five/form/__init__.py2007-09-16
17:15:42 UTC (rev 79698)
@@ -120,14 +120,11 @@
names=self.fieldNames)
if changed:
self.changed()
-# XXX: Needs locale support:
-#formatter = self.request.locale.dates.getFormatter(
-#'dateTime', 'medium')
-#status = _(Updated on ${date_time},
-# mapping={'date_time':
-#formatter.format(datetime.utcnow())})
+formatter = self.request.locale.dates.getFormatter(
+ 'dateTime', 'medium')
status = _(Updated on ${date_time},
- mapping={'date_time': str(datetime.utcnow())})
+ mapping={'date_time':
+ formatter.format(datetime.utcnow())})
self.update_status = status
return status
Modified: Zope/trunk/lib/python/Products/Five/formlib/formbase.py
===
--- Zope/trunk/lib/python/Products/Five/formlib/formbase.py 2007-09-16
16:54:06 UTC (rev 79697)
+++ Zope/trunk/lib/python/Products/Five/formlib/formbase.py 2007-09-16
17:15:42 UTC (rev 79698)
@@ -60,27 +60,8 @@
class EditFormBase(FiveFormlibMixin, form.EditFormBase):
+pass
-# Overrides formlib.form.EditFormBase.handle_edit_action, to remove
-# dependecy on request.locale
-
-@form.action(_(Apply), condition=form.haveInputWidgets)
-def handle_edit_action(self, action, data):
-if form.applyChanges(
-self.context, self.form_fields, data, self.adapters):
-
-zope.event.notify(
-zope.lifecycleevent.ObjectModifiedEvent(self.context)
-)
-# TODO: Needs locale support. See also Five.form.EditView.
-self.status = _(
-Updated on ${date_time},
-mapping={'date_time': str(datetime.utcnow())}
-)
-else:
-self.status = _('No changes')
-
-
class DisplayFormBase(FiveFormlibMixin, form.DisplayFormBase):
pass
Modified: Zope/trunk/lib/python/ZPublisher/HTTPRequest.py
===
--- Zope/trunk/lib/python/ZPublisher/HTTPRequest.py 2007-09-16 16:54:06 UTC
(rev 79697)
+++ Zope/trunk/lib/python/ZPublisher/HTTPRequest.py 2007-09-16 17:15:42 UTC
(rev 79698)
@@ -13,7 +13,7 @@
__version__='$Revision: 1.96 $'[11:-2]
-import re, sys, os, time, random, codecs, inspect, tempfile
+import re, sys, os, time, random, codecs, tempfile
from types import StringType, UnicodeType
from BaseRequest import BaseRequest, quote
from HTTPResponse import HTTPResponse
@@ -25,6 +25,8 @@
from maybe_lock import allocate_lock
xmlrpc=None # Placeholder for module that we'll import if we have to.
+from zope.i18n.interfaces import