r450 - in zope-formulator/branches/upstream/current: . i18n i18n/de
i18n/de/LC_MESSAGES i18n/fr i18n/fr/LC_MESSAGES i18n/nl
i18n/nl/LC_MESSAGES tests
Fabio Tranchitella
kobold at alioth.debian.org
Thu Nov 9 10:44:31 CET 2006
Author: kobold
Date: 2006-11-09 10:44:30 +0100 (Thu, 09 Nov 2006)
New Revision: 450
Added:
zope-formulator/branches/upstream/current/configure.zcml
zope-formulator/branches/upstream/current/i18n/de/
zope-formulator/branches/upstream/current/i18n/de/LC_MESSAGES/
zope-formulator/branches/upstream/current/i18n/de/LC_MESSAGES/formulator.mo
zope-formulator/branches/upstream/current/i18n/de/LC_MESSAGES/formulator.po
zope-formulator/branches/upstream/current/i18n/fr/
zope-formulator/branches/upstream/current/i18n/fr/LC_MESSAGES/
zope-formulator/branches/upstream/current/i18n/fr/LC_MESSAGES/formulator.mo
zope-formulator/branches/upstream/current/i18n/fr/LC_MESSAGES/formulator.po
zope-formulator/branches/upstream/current/i18n/nl/
zope-formulator/branches/upstream/current/i18n/nl/LC_MESSAGES/
zope-formulator/branches/upstream/current/i18n/nl/LC_MESSAGES/formulator.mo
zope-formulator/branches/upstream/current/i18n/nl/LC_MESSAGES/formulator.po
zope-formulator/branches/upstream/current/monkey.py
Removed:
zope-formulator/branches/upstream/current/i18n/dummymessageid.py
zope-formulator/branches/upstream/current/i18n/formulator-fr.po
zope-formulator/branches/upstream/current/i18n/formulator-nl.po
zope-formulator/branches/upstream/current/i18n/formulatormessageid.py
Modified:
zope-formulator/branches/upstream/current/CREDITS.txt
zope-formulator/branches/upstream/current/Errors.py
zope-formulator/branches/upstream/current/Field.py
zope-formulator/branches/upstream/current/FieldRegistry.py
zope-formulator/branches/upstream/current/Form.py
zope-formulator/branches/upstream/current/FormToXML.py
zope-formulator/branches/upstream/current/HISTORY.txt
zope-formulator/branches/upstream/current/INSTALL.txt
zope-formulator/branches/upstream/current/README.txt
zope-formulator/branches/upstream/current/TODO.txt
zope-formulator/branches/upstream/current/Validator.py
zope-formulator/branches/upstream/current/Widget.py
zope-formulator/branches/upstream/current/XMLToForm.py
zope-formulator/branches/upstream/current/__init__.py
zope-formulator/branches/upstream/current/i18n/__init__.py
zope-formulator/branches/upstream/current/tests/test_serialize.py
zope-formulator/branches/upstream/current/tests/test_validators.py
zope-formulator/branches/upstream/current/version.txt
Log:
Load /tmp/tmp.gQSsmV6613/zope-formulator-1.11.2 into
zope-formulator/branches/upstream/current.
Modified: zope-formulator/branches/upstream/current/CREDITS.txt
===================================================================
--- zope-formulator/branches/upstream/current/CREDITS.txt 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/CREDITS.txt 2006-11-09 09:44:30 UTC (rev 450)
@@ -63,6 +63,8 @@
Guido Wesdorp (guido at infrae.com) -- Added extra_item attribute on
compound fields, bugfixes.
+ -- Fixed unicode error in XMLToForm.
+
Yura Petrov (ypetrov at naumen.ru) -- Various FSForm related
improvements.
@@ -84,13 +86,16 @@
He Wei (hewei at ied.org.cn) -- ZMI and Unicode related fixes
- Bertrand Croq (bertrand.croq at freeskop.com) -- Fixes for a Unicode issue
- related to titles of new fields
+ Bertrand Croq (bertrand.croq at freeskop.com) --
+ Fixes for a Unicode issue related to titles of new fields
+ and label for radiobuttons patch
Ian Duggan (ian at swishmark.com) -- "Hide day" in DateTimeField feature
Reinout van Rees (reinout at vanrees.org) -- LabelField validation bugfix
+ Mikaël Barbero (mikael at emu-france.com) -- ZMI enhancement.
+
Special thanks also goes to Rik Hoekstra.
Also a thank you to those few valiant souls who suffered through the
Modified: zope-formulator/branches/upstream/current/Errors.py
===================================================================
--- zope-formulator/branches/upstream/current/Errors.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/Errors.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -4,7 +4,7 @@
# scripts. To do so, add the following line to your Py script:
# from Products.Formulator.Errors import ValidationError, FormValidationError
-from Products.PythonScripts.Utility import allow_class
+from AccessControl import allow_class
class FormValidationError(Exception):
Modified: zope-formulator/branches/upstream/current/Field.py
===================================================================
--- zope-formulator/branches/upstream/current/Field.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/Field.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -7,10 +7,11 @@
from Errors import ValidationError
from Products.Formulator.Widget import MultiItemsWidget
from helpers import is_sequence, convert_unicode
-from Products.Formulator.i18n import translate as _
from Products.PageTemplates.Expressions import SecureModuleImporter
+from zope.i18nmessageid import MessageIDFactory
+
class Field:
"""Base class of all fields.
A field is an object consisting of a widget and a validator.
@@ -127,12 +128,12 @@
# if normal value is a callable itself, wrap it
if callable(value):
return value.__of__(self)
-
+
# create message id for title and description in right domain
if id in ['title', 'description']:
i18n_domain = self.get_i18n_domain()
if i18n_domain:
- return _(value, i18n_domain)
+ return MessageIDFactory(i18n_domain)(value)
return value
# this also works if field is not in form for testing
@@ -204,21 +205,16 @@
# if we don't want message id, strip it off
if not want_message_id:
try:
- # looks into message id internals..
- result = result.ustr
+ # convert message id into unicode string
+ result = unicode(result)
except AttributeError:
pass
return result
- if want_message_id:
- # we do want a message id, so construct one from form domain
- result = _(result, self.get_i18n_domain())
else:
- try:
- # looks into message id internals..
- result = result.ustr
- except AttributeError:
- pass
- return result
+ if want_message_id:
+ # we do want a message id, so construct one from form domain
+ result = MessageIDFactory(self.get_i18n_domain())(result)
+ return result
security.declarePrivate('_render_helper')
def _render_helper(self, key, value, REQUEST):
Modified: zope-formulator/branches/upstream/current/FieldRegistry.py
===================================================================
--- zope-formulator/branches/upstream/current/FieldRegistry.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/FieldRegistry.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -87,38 +87,40 @@
override_form = BasicForm()
tales_form = BasicForm()
for field in getPropertyFields(field_class.widget):
- form.add_field(field, "widget")
+ group = field.get_value("group") or "widget"
+ form.add_field(field, group)
tales_field = fields.TALESField(field.id,
title=field.get_value('title'),
description="",
default="",
display_width=40,
required=0)
- tales_form.add_field(tales_field, "widget")
+ tales_form.add_field(tales_field, group)
method_field = fields.MethodField(field.id,
title=field.get_value("title"),
description="",
default="",
required=0)
- override_form.add_field(method_field, "widget")
+ override_form.add_field(method_field, group)
for field in getPropertyFields(field_class.validator):
- form.add_field(field, "validator")
+ group = field.get_value("group") or "validator"
+ form.add_field(field, group)
tales_field = fields.TALESField(field.id,
title=field.get_value('title'),
description="",
default="",
display_with=40,
required=0)
- tales_form.add_field(tales_field, "validator")
+ tales_form.add_field(tales_field, group)
method_field = fields.MethodField(field.id,
title=field.get_value("title"),
description="",
default="",
required=0)
- override_form.add_field(method_field, "validator")
+ override_form.add_field(method_field, group)
field_class.form = form
field_class.override_form = override_form
Modified: zope-formulator/branches/upstream/current/Form.py
===================================================================
--- zope-formulator/branches/upstream/current/Form.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/Form.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -779,7 +779,13 @@
# security declaration for the generic "add field" form,
# which is set as a class attribute in "initializeForm" later on
security.declareProtected('Change Formulator Forms', 'fieldAdd')
+ def fieldAdd(self):
+ """Dummy implementation, set in initializeForm later on.
+ This is use to shut up Zope's security warnings. Hopefully it's still
+ secure...
+ """
+
security.declareProtected('View management screens', 'formTest')
formTest = DTMLFile('dtml/formTest', globals())
Modified: zope-formulator/branches/upstream/current/FormToXML.py
===================================================================
--- zope-formulator/branches/upstream/current/FormToXML.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/FormToXML.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -89,8 +89,10 @@
message_text = field.get_error_message(message_key,
want_message_id=False)
# we don't want unicode here
- if isinstance(message_text, unicode):
- message_text = message_text.encode(form.stored_encoding)
+ if not form.unicode_mode:
+ if isinstance(message_text, unicode):
+ message_text = message_text.encode(
+ form.stored_encoding)
write(' <message name="%s">%s</message>\n' %
(escape(message_key), escape(message_text)))
write(' </messages>\n')
Modified: zope-formulator/branches/upstream/current/HISTORY.txt
===================================================================
--- zope-formulator/branches/upstream/current/HISTORY.txt 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/HISTORY.txt 2006-11-09 09:44:30 UTC (rev 450)
@@ -1,5 +1,55 @@
Formulator changes
+ 1.11.2
+
+ Bugs fixed
+
+ - Copied fix from the 1.10 branch, TypeError when passing something other
+ than a string into the Validator.
+
+ 1.11.1
+
+ Bugs fixed
+
+ - Shut up startup warnings about security declarations in Zope
+ 2.8.5.
+
+ 1.11
+
+ Features Added
+
+ - Formulator now needs Zope 2.8.4 + Five 1.2. It uses Five's
+ i18n architecture instead of PlacelessTranslationService.
+ Five 1.2 can be downloaded at http://codespeak.net/z3/five
+
+ If you do not want to install Five 1.2 for some reason, simply
+ remove 'configure.zcml' in the Formulator package. Formulator
+ will then work (but not have i18n support) in a plain Zope 2.8
+ installation.
+
+ - Radiobuttons are now rendered with a label around
+ their field value, allowing to click on the value
+ instead of the radio button itself.
+ (Patch from Bertrand Croq)
+
+ Bugs fixed
+
+ - Fixed unicode issues in FormToXML, when the form was in unicode mode
+ and message fields contained non-ascii chars, XML serialization didn't
+ work.
+
+ 1.10
+
+ Features Added
+
+ - Allow to group fields of the ZMI form for each field
+ into more groups than the default "widget" and "validator"
+ (Patch from Mikaël Barbero)
+
+ Bugs fixed
+
+ - Fixed AttributeError (on __call__) on DummyMessageID.
+
1.9.0
Features Added
@@ -59,7 +109,7 @@
Bugs Fixed
- - Added explicit security declatation for the "fieldAdd" DTML-file.
+ - Added explicit security declaration for the "fieldAdd" DTML-file.
This fixed a problem with copy & paste fields in Zope 2.7.3.
- Fields having been removed via the XML tab in the ZMI still
Modified: zope-formulator/branches/upstream/current/INSTALL.txt
===================================================================
--- zope-formulator/branches/upstream/current/INSTALL.txt 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/INSTALL.txt 2006-11-09 09:44:30 UTC (rev 450)
@@ -2,20 +2,30 @@
Requirements
- Formulator should work with Zope versions 2.6 or higher:
+ Formulator should work with Zope versions 2.8 or higher:
http://www.zope.org/Products/Zope
- For reading in forms as XML you need to have minidom installed;
- this should come with a normal python 2.1 distribution. This is
- not required to use Formulator, however.
-
Upgrading
- to 1.8.x from earlier versions
+ to 1.11 from earlier versions
+ Five 1.2 is needed to make i18n work. Alternatively remove the
+ file `configure.zcml` from the Formulator directory -- this is
+ safe and just removes the i18n support.
+
+ to 1.9 from 1.8
+
There should be no problems.
+ to 1.8 from 1.7
+
+ Note that the i18n-features added in 1.7
+ have been cut down a little; if You have relied on
+ Formulator to do the translations automagically in 1.7
+ You might need to add a few i18n-statements to Your
+ form rendering template to get the translations working with 1.8
+
to 1.6.x from earlier versions
There should be no problems.
Modified: zope-formulator/branches/upstream/current/README.txt
===================================================================
--- zope-formulator/branches/upstream/current/README.txt 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/README.txt 2006-11-09 09:44:30 UTC (rev 450)
@@ -33,7 +33,7 @@
Information is also available at the Formulator web site:
- http://www.zope.org/Members/faassen/Formulator
+ http://www.infrae.com/products/formulator
There are also instructions to join the Formulator mailing list there.
Discussion about Formulator should preferably happen on the mailing list
Modified: zope-formulator/branches/upstream/current/TODO.txt
===================================================================
--- zope-formulator/branches/upstream/current/TODO.txt 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/TODO.txt 2006-11-09 09:44:30 UTC (rev 450)
@@ -12,8 +12,6 @@
- Investigate duration and time only field.
- - internationalisation (or error messages first)
-
- HTML filtering field?
- Add more unit tests.
Modified: zope-formulator/branches/upstream/current/Validator.py
===================================================================
--- zope-formulator/branches/upstream/current/Validator.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/Validator.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -77,7 +77,7 @@
message_names = ValidatorBase.message_names + ['external_validator_failed']
- external_validator_failed = "The input failed the external validator."
+ external_validator_failed = _('The input failed the external validator.')
class StringBaseValidator(Validator):
"""Simple string validator.
@@ -111,6 +111,10 @@
return value
def serializeValue(self, field, value, producer):
+ # if our value is not a string type, the SAX lib won't eat it,
+ # therefore convert to string first
+ if type(value) not in (str, unicode):
+ value = str(value)
producer.handler.characters(value)
class StringValidator(StringBaseValidator):
Modified: zope-formulator/branches/upstream/current/Widget.py
===================================================================
--- zope-formulator/branches/upstream/current/Widget.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/Widget.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -647,21 +647,23 @@
return string.join(rendered_items, "<br />")
def render_item(self, text, value, key, css_class, extra_item):
- return render_element('input',
- type="radio",
- css_class=css_class,
- name=key,
- value=value,
- extra=extra_item) + text
+ contents = render_element('input',
+ type="radio",
+ css_class=css_class,
+ name=key,
+ value=value,
+ extra=extra_item) + text
+ return render_element('label', contents=contents)
def render_selected_item(self, text, value, key, css_class, extra_item):
- return render_element('input',
- type="radio",
- css_class=css_class,
- name=key,
- value=value,
- checked=None,
- extra=extra_item) + text
+ contents = render_element('input',
+ type="radio",
+ css_class=css_class,
+ name=key,
+ value=value,
+ checked=None,
+ extra=extra_item) + text
+ return render_element('label', contents=contents)
RadioWidgetInstance = RadioWidget()
Modified: zope-formulator/branches/upstream/current/XMLToForm.py
===================================================================
--- zope-formulator/branches/upstream/current/XMLToForm.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/XMLToForm.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -110,11 +110,12 @@
entries = getattr(messages.elements, 'message', [])
for entry in entries:
name = entry.attributes.get('name')
- text = encode(entry.text, encoding)
+ text = entry.text
# ignore messages that are identical to default
if (name in field.validator.message_names and
getattr(field.validator, name) == text):
continue
+ text = encode(text, encoding)
field.message_values[name] = text
# for persistence machinery
Modified: zope-formulator/branches/upstream/current/__init__.py
===================================================================
--- zope-formulator/branches/upstream/current/__init__.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/__init__.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -3,7 +3,7 @@
import StandardFields, HelperFields
from FieldRegistry import FieldRegistry
import Errors
-from Products.PythonScripts.Utility import allow_module
+from AccessControl import allow_module
try:
import Products.FileSystemSite
@@ -87,3 +87,7 @@
context.registerHelp()
# register field help for all fields
FieldRegistry.registerFieldHelp(context)
+
+# monkey patches
+import monkey
+monkey.patch_all()
Added: zope-formulator/branches/upstream/current/configure.zcml
===================================================================
--- zope-formulator/branches/upstream/current/configure.zcml 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/configure.zcml 2006-11-09 09:44:30 UTC (rev 450)
@@ -0,0 +1,9 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ >
+
+ <!-- i18n -->
+ <i18n:registerTranslations directory="i18n" />
+
+</configure>
Modified: zope-formulator/branches/upstream/current/i18n/__init__.py
===================================================================
--- zope-formulator/branches/upstream/current/i18n/__init__.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/i18n/__init__.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -2,18 +2,12 @@
from Products.Formulator.i18n import translate as _
- and will provide, if PlacelessTranslationService is installed, a
- MessageIDFactory that returns MessageIDs for i18n'ing Product code
- and Python scripts.
+and will provide a MessageIDFactory that returns MessageIDs for
+i18n'ing Product code and Python scripts.
- If PlacelessTranslationService is not installed, it will return a
- 'dummy' object that provides the MessageID interface but doesn't
- translate strings (it just returns what comes in, optionally interpolating
- values)
+Five 1.2 or later needs to be installed to make this work.
"""
-try:
- from Products import PlacelessTranslationService
- from formulatormessageid import FormulatorMessageIDFactory as translate
-except ImportError:
- from dummymessageid import DummyMessageIDFactory as translate
+from zope.i18nmessageid import MessageIDFactory
+
+translate = MessageIDFactory('formulator')
Added: zope-formulator/branches/upstream/current/i18n/de/LC_MESSAGES/formulator.mo
===================================================================
(Binary files differ)
Property changes on: zope-formulator/branches/upstream/current/i18n/de/LC_MESSAGES/formulator.mo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: zope-formulator/branches/upstream/current/i18n/de/LC_MESSAGES/formulator.po
===================================================================
--- zope-formulator/branches/upstream/current/i18n/de/LC_MESSAGES/formulator.po 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/i18n/de/LC_MESSAGES/formulator.po 2006-11-09 09:44:30 UTC (rev 450)
@@ -0,0 +1,77 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Formulator\n"
+"POT-Creation-Date: Tue Nov 30 15:27:19 2004\n"
+"PO-Revision-Date: 2005-09-23 23:55+0200\n"
+"Last-Translator: Clemens Robbenhaar <crobbenhaar at web.de>\n"
+"Language-Team: Infrae i18n team <walco at infrae.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: zope/app/translation_files/extract.py\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"Language-code: de\n"
+"Language-name: Deutsch\n"
+"X-Is-Fallback-For: de-ch de-at de-li de-lu de-de\n"
+"Preferred-encodings: utf-8 latin1\n"
+"Domain: formulator\n"
+
+#: /Validator.py:134
+msgid "Too much input was given."
+msgstr "Die Eingabe ist mir zu lang."
+
+#: /Validator.py:157
+msgid "You did not enter an email address."
+msgstr "Die e-mail Adresse ist in keinem gültigen Format."
+
+#: /Validator.py:202
+msgid "The entered value did not match the pattern."
+msgstr "Der eingebene Wert passt nicht zu dem vorgegebenen Muster."
+
+#: /Validator.py:245
+msgid "You did not enter an integer."
+msgstr "Ihre Eingabe ist keine Zahl."
+
+#: /Validator.py:246
+msgid "The integer you entered was out of range."
+msgstr "Die eingegeben Zahl ligt nicht im gültigen Bereich."
+
+#: /Validator.py:272
+msgid "You did not enter a floating point number."
+msgstr "Ihre Eingabe ist keine Fliesskommazahl."
+
+#: /Validator.py:325
+msgid "You entered too many lines."
+msgstr "Das sind mir zu viele Zeilen."
+
+#: /Validator.py:326
+msgid "A line was too long."
+msgstr "Eine derZeilen ist zu lang. Leider habe ich vergessen, welche."
+
+#: /Validator.py:327
+msgid "You entered too many characters."
+msgstr "Die Eingabe besteht aus zu vielen Zeichen."
+
+#: /Validator.py:392
+#: /Validator.py:448
+msgid "You selected an item that was not in the list."
+msgstr "Ihre Auswahl ist nicht in der Liste vorhanden."
+
+#: /Validator.py:552
+msgid "The specified link is broken."
+msgstr "Der Link zeigt ins Leere."
+
+#: /Validator.py:636
+msgid "You did not enter a valid date and time."
+msgstr "Ein solches Datum existiert nicht."
+
+#: /Validator.py:637
+msgid "The date and time you entered were out of range."
+msgstr "Das Datum liegt nicht innerhalb des gewünschten Bereichs."
+
+#: /Validator.py:93
+#: /Validator.py:447
+#: /Validator.py:635
+msgid "Input is required but no input given."
+msgstr "Das Eingabefeld sollte nicht leer gelassen werden."
+
Deleted: zope-formulator/branches/upstream/current/i18n/dummymessageid.py
===================================================================
--- zope-formulator/branches/upstream/current/i18n/dummymessageid.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/i18n/dummymessageid.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -1,53 +0,0 @@
-import re
-
-class DummyMessageID:
- """Dummy MessageID object
-
- is returned by the dummy MessageIDFactory, which is used
- when PlacelessTranslationService can not be imported.
- """
- mapping = None
- reg_interpolation = re.compile('\$\{([a-zA-Z0-9_]*)\}')
- __allow_access_to_unprotected_subobjects__ = 1
-
- def __init__(self, input):
- """store the input to return (untranslated) later on __str__()"""
- if not isinstance(input, basestring):
- input = str(input)
- self.ustr = self.__str = input
- self.__parsed = None
-
- def set_mapping(self, mapping):
- """Set a mapping for message interpolation
- """
- self.mapping = mapping
-
- def translate(self):
- """Return a stringified version of the input
-
- values in the form ${<varname>} are interpolated from
- self.mapping (if available)
- """
- if self.__parsed is not None:
- return self.__parsed
- if self.mapping is None and not self.reg_interpolation.search(self.__str):
- return self.__str
- s = self.__str
- mapping = self.mapping
- while 1:
- match = self.reg_interpolation.search(s)
- if not match:
- break
- try:
- s = s.replace(match.group(0), mapping[match.group(1)])
- except KeyError:
- raise KeyError, match.group(1)
- self.__parsed = s
- return s
-
- def __str__(self):
- return self.translate()
-
-def DummyMessageIDFactory(input, default=None):
- return DummyMessageID(input)
-
Deleted: zope-formulator/branches/upstream/current/i18n/formulator-fr.po
===================================================================
--- zope-formulator/branches/upstream/current/i18n/formulator-fr.po 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/i18n/formulator-fr.po 2006-11-09 09:44:30 UTC (rev 450)
@@ -1,75 +0,0 @@
-msgid ""
-msgstr ""
-"Project-Id-Version: Formulator\n"
-"POT-Creation-Date: Tue Nov 30 15:27:19 2004\n"
-"PO-Revision-Date: 2005-05-12 09:31+0100\n"
-"Last-Translator: Joaquin POMBAR <joaquin.pombar at wanadoo.fr>\n"
-"Language-Team: jpombar\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Generated-By: zope/app/translation_files/extract.py\n"
-"Language-code: fr\n"
-"Language-name: French\n"
-"Preferred-encodings: utf-8\n"
-"Domain: formulator\n"
-
-#: /Validator.py:134
-msgid "Too much input was given."
-msgstr "Trop d'entrées ont été données"
-
-#: /Validator.py:157
-msgid "You did not enter an email address."
-msgstr "Vous n'avez pas saisi une adresse email"
-
-#: /Validator.py:202
-msgid "The entered value did not match the pattern."
-msgstr "Le valeurs saisies ne correspondent pas au modèle"
-
-#: /Validator.py:245
-msgid "You did not enter an integer."
-msgstr "Vous n'avez pas saisi un entier"
-
-#: /Validator.py:246
-msgid "The integer you entered was out of range."
-msgstr "L'entier saisi était hors du rang"
-
-#: /Validator.py:272
-msgid "You did not enter a floating point number."
-msgstr "Vous n'avez pas saisi un nombre à point flottant"
-
-#: /Validator.py:325
-msgid "You entered too many lines."
-msgstr "Vous avez saisi trop de lignes"
-
-#: /Validator.py:326
-msgid "A line was too long."
-msgstr "Une ligne était trop longue"
-
-#: /Validator.py:327
-msgid "You entered too many characters."
-msgstr "Vous avez saisi trop de caractères"
-
-#: /Validator.py:392
-#: /Validator.py:448
-msgid "You selected an item that was not in the list."
-msgstr "Vous avez saisi un item qui n'est pas dans la liste"
-
-#: /Validator.py:552
-msgid "The specified link is broken."
-msgstr "Le lien spécifié n'est pas disponible"
-
-#: /Validator.py:636
-msgid "You did not enter a valid date and time."
-msgstr "Vous n'avez pas saisi une date et heure valide"
-
-#: /Validator.py:637
-msgid "The date and time you entered were out of range."
-msgstr "La date et heure saisi sont hors du rang"
-
-#: /Validator.py:93
-#: /Validator.py:447
-#: /Validator.py:635
-msgid "Input is required but no input given."
-msgstr "Vous devez saisir une entrée"
-
Deleted: zope-formulator/branches/upstream/current/i18n/formulator-nl.po
===================================================================
--- zope-formulator/branches/upstream/current/i18n/formulator-nl.po 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/i18n/formulator-nl.po 2006-11-09 09:44:30 UTC (rev 450)
@@ -1,73 +0,0 @@
-msgid ""
-msgstr ""
-"Project-Id-Version: Formulator\n"
-"POT-Creation-Date: Tue Nov 30 15:27:19 2004\n"
-"PO-Revision-Date: 2004-11-29 17:38+0100\n"
-"Last-Translator: Martijn Faassen <faassen at infrae.com>\n"
-"Language-Team: Infrae i18n team <walco at infrae.com>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Generated-By: zope/app/translation_files/extract.py\n"
-"Plural-Forms: nplurals=1; plural=0;\n"
-"Language-code: nl\n"
-"Language-name: Nederlands\n"
-"Preferred-encodings: utf-8\n"
-"Domain: formulator\n"
-
-#: /Validator.py:134
-msgid "Too much input was given."
-msgstr "Te veel informatie ingevoerd."
-
-#: /Validator.py:157
-msgid "You did not enter an email address."
-msgstr "Geen geldig email adres ingevoerd."
-
-#: /Validator.py:202
-msgid "The entered value did not match the pattern."
-msgstr "Het ingevoerde voldeed niet aan het patroon."
-
-#: /Validator.py:245
-msgid "You did not enter an integer."
-msgstr "Geen geheel getal ingevoerd."
-
-#: /Validator.py:246
-msgid "The integer you entered was out of range."
-msgstr "Het ingevoerde gehele getal was buiten de grenzen."
-
-#: /Validator.py:272
-msgid "You did not enter a floating point number."
-msgstr "Geen gebroken getal (met een punt) ingevoerd."
-
-#: /Validator.py:325
-msgid "You entered too many lines."
-msgstr "Te veel regels ingevoerd."
-
-#: /Validator.py:326
-msgid "A line was too long."
-msgstr "Een regel was te lang."
-
-#: /Validator.py:327
-msgid "You entered too many characters."
-msgstr "Te veel karakters ingevoerd."
-
-#: /Validator.py:392 /Validator.py:448
-msgid "You selected an item that was not in the list."
-msgstr "Er is een item geselecteerd dat niet in de lijst zit."
-
-#: /Validator.py:552
-msgid "The specified link is broken."
-msgstr "De link is gebroken."
-
-#: /Validator.py:636
-msgid "You did not enter a valid date and time."
-msgstr "Geen geldige datum/tijd ingevoerd."
-
-#: /Validator.py:637
-msgid "The date and time you entered were out of range."
-msgstr "De ingevoerde datum/tijd was buiten de grenzen."
-
-#: /Validator.py:93 /Validator.py:447 /Validator.py:635
-msgid "Input is required but no input given."
-msgstr "Verplichte invoer niet ontvangen"
-
Deleted: zope-formulator/branches/upstream/current/i18n/formulatormessageid.py
===================================================================
--- zope-formulator/branches/upstream/current/i18n/formulatormessageid.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/i18n/formulatormessageid.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -1,15 +0,0 @@
-from Products.PlacelessTranslationService.MessageID import MessageIDFactory
-from Products.PlacelessTranslationService.MessageID import MessageIDUnicode
-
-class FormulatorMessageIDUnicode(MessageIDUnicode):
- """
- """
- __allow_access_to_unprotected_subobjects__ = 1
- def set_mapping(self, mapping):
- """Set a mapping for message interpolation
- """
- self.mapping = mapping
-
-def FormulatorMessageIDFactory(ustr, domain='formulator'):
- return FormulatorMessageIDUnicode(ustr, domain)
-
Added: zope-formulator/branches/upstream/current/i18n/fr/LC_MESSAGES/formulator.mo
===================================================================
(Binary files differ)
Property changes on: zope-formulator/branches/upstream/current/i18n/fr/LC_MESSAGES/formulator.mo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: zope-formulator/branches/upstream/current/i18n/fr/LC_MESSAGES/formulator.po
===================================================================
--- zope-formulator/branches/upstream/current/i18n/fr/LC_MESSAGES/formulator.po 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/i18n/fr/LC_MESSAGES/formulator.po 2006-11-09 09:44:30 UTC (rev 450)
@@ -0,0 +1,75 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Formulator\n"
+"POT-Creation-Date: Tue Nov 30 15:27:19 2004\n"
+"PO-Revision-Date: 2005-05-12 09:31+0100\n"
+"Last-Translator: Joaquin POMBAR <joaquin.pombar at wanadoo.fr>\n"
+"Language-Team: jpombar\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: zope/app/translation_files/extract.py\n"
+"Language-code: fr\n"
+"Language-name: French\n"
+"Preferred-encodings: utf-8\n"
+"Domain: formulator\n"
+
+#: /Validator.py:134
+msgid "Too much input was given."
+msgstr "Trop d'entrées ont été données"
+
+#: /Validator.py:157
+msgid "You did not enter an email address."
+msgstr "Vous n'avez pas saisi une adresse email"
+
+#: /Validator.py:202
+msgid "The entered value did not match the pattern."
+msgstr "Le valeurs saisies ne correspondent pas au modèle"
+
+#: /Validator.py:245
+msgid "You did not enter an integer."
+msgstr "Vous n'avez pas saisi un entier"
+
+#: /Validator.py:246
+msgid "The integer you entered was out of range."
+msgstr "L'entier saisi était hors du rang"
+
+#: /Validator.py:272
+msgid "You did not enter a floating point number."
+msgstr "Vous n'avez pas saisi un nombre à point flottant"
+
+#: /Validator.py:325
+msgid "You entered too many lines."
+msgstr "Vous avez saisi trop de lignes"
+
+#: /Validator.py:326
+msgid "A line was too long."
+msgstr "Une ligne était trop longue"
+
+#: /Validator.py:327
+msgid "You entered too many characters."
+msgstr "Vous avez saisi trop de caractères"
+
+#: /Validator.py:392
+#: /Validator.py:448
+msgid "You selected an item that was not in the list."
+msgstr "Vous avez saisi un item qui n'est pas dans la liste"
+
+#: /Validator.py:552
+msgid "The specified link is broken."
+msgstr "Le lien spécifié n'est pas disponible"
+
+#: /Validator.py:636
+msgid "You did not enter a valid date and time."
+msgstr "Vous n'avez pas saisi une date et heure valide"
+
+#: /Validator.py:637
+msgid "The date and time you entered were out of range."
+msgstr "La date et heure saisi sont hors du rang"
+
+#: /Validator.py:93
+#: /Validator.py:447
+#: /Validator.py:635
+msgid "Input is required but no input given."
+msgstr "Vous devez saisir une entrée"
+
Added: zope-formulator/branches/upstream/current/i18n/nl/LC_MESSAGES/formulator.mo
===================================================================
(Binary files differ)
Property changes on: zope-formulator/branches/upstream/current/i18n/nl/LC_MESSAGES/formulator.mo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: zope-formulator/branches/upstream/current/i18n/nl/LC_MESSAGES/formulator.po
===================================================================
--- zope-formulator/branches/upstream/current/i18n/nl/LC_MESSAGES/formulator.po 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/i18n/nl/LC_MESSAGES/formulator.po 2006-11-09 09:44:30 UTC (rev 450)
@@ -0,0 +1,73 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Formulator\n"
+"POT-Creation-Date: Tue Nov 30 15:27:19 2004\n"
+"PO-Revision-Date: 2004-11-29 17:38+0100\n"
+"Last-Translator: Martijn Faassen <faassen at infrae.com>\n"
+"Language-Team: Infrae i18n team <walco at infrae.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: zope/app/translation_files/extract.py\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"Language-code: nl\n"
+"Language-name: Nederlands\n"
+"Preferred-encodings: utf-8\n"
+"Domain: formulator\n"
+
+#: /Validator.py:134
+msgid "Too much input was given."
+msgstr "Te veel informatie ingevoerd."
+
+#: /Validator.py:157
+msgid "You did not enter an email address."
+msgstr "Geen geldig email adres ingevoerd."
+
+#: /Validator.py:202
+msgid "The entered value did not match the pattern."
+msgstr "Het ingevoerde voldeed niet aan het patroon."
+
+#: /Validator.py:245
+msgid "You did not enter an integer."
+msgstr "Geen geheel getal ingevoerd."
+
+#: /Validator.py:246
+msgid "The integer you entered was out of range."
+msgstr "Het ingevoerde gehele getal was buiten de grenzen."
+
+#: /Validator.py:272
+msgid "You did not enter a floating point number."
+msgstr "Geen gebroken getal (met een punt) ingevoerd."
+
+#: /Validator.py:325
+msgid "You entered too many lines."
+msgstr "Te veel regels ingevoerd."
+
+#: /Validator.py:326
+msgid "A line was too long."
+msgstr "Een regel was te lang."
+
+#: /Validator.py:327
+msgid "You entered too many characters."
+msgstr "Te veel karakters ingevoerd."
+
+#: /Validator.py:392 /Validator.py:448
+msgid "You selected an item that was not in the list."
+msgstr "Er is een item geselecteerd dat niet in de lijst zit."
+
+#: /Validator.py:552
+msgid "The specified link is broken."
+msgstr "De link is gebroken."
+
+#: /Validator.py:636
+msgid "You did not enter a valid date and time."
+msgstr "Geen geldige datum/tijd ingevoerd."
+
+#: /Validator.py:637
+msgid "The date and time you entered were out of range."
+msgstr "De ingevoerde datum/tijd was buiten de grenzen."
+
+#: /Validator.py:93 /Validator.py:447 /Validator.py:635
+msgid "Input is required but no input given."
+msgstr "Verplichte invoer niet ontvangen"
+
Added: zope-formulator/branches/upstream/current/monkey.py
===================================================================
--- zope-formulator/branches/upstream/current/monkey.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/monkey.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -0,0 +1,11 @@
+from AccessControl import allow_class
+
+def monkey_zope3_message_id():
+ from zope.i18nmessageid.messageid import MessageID
+
+ # open it up for Zope 2...
+ allow_class(MessageID)
+
+def patch_all():
+ monkey_zope3_message_id()
+
Modified: zope-formulator/branches/upstream/current/tests/test_serialize.py
===================================================================
--- zope-formulator/branches/upstream/current/tests/test_serialize.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/tests/test_serialize.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
@@ -250,7 +253,7 @@
self.assertEquals(1, len(e.errors))
text2 = e.errors[0].error_text
# XXX compare original message ids..
- self.assertEquals(text1.ustr, text2.ustr)
+ self.assertEquals(unicode(text1), unicode(text2))
def test_fieldValueTypes(self):
@@ -473,7 +476,125 @@
self.failIf( form2.has_field('another_field') )
self.failIf('another_field' in form2.objectIds() )
+ def test_serializeDeserializeEncodedMessages(self):
+ # test for serializing and deserializing XML with non-ascii text in
+ # the message tags
+ xml1 = """\
+<?xml version="1.0"?>
+<form>
+ <title></title>
+ <row_length>4</row_length>
+ <name>testform_bugs</name>
+ <action></action>
+ <method>POST</method>
+ <enctype></enctype>
+ <encoding>UTF-8</encoding>
+ <stored_encoding>UTF-8</stored_encoding>
+ <unicode_mode>false</unicode_mode>
+ <i18n_domain></i18n_domain>
+ <groups>
+ <group>
+ <title>Default</title>
+ <fields>
+
+ <field><id>string</id> <type>StringField</type>
+ <values>
+ <alternate_name></alternate_name>
+ <css_class></css_class>
+ <default></default>
+ <description>मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</description>
+ <display_maxwidth></display_maxwidth>
+ <display_width type="int">20</display_width>
+ <enabled type="int">1</enabled>
+ <external_validator></external_validator>
+ <extra></extra>
+ <hidden type="int">0</hidden>
+ <max_length></max_length>
+ <required type="int">1</required>
+ <title>मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</title>
+ <truncate type="int">0</truncate>
+ <unicode type="int">0</unicode>
+ <whitespace_preserve type="int">0</whitespace_preserve>
+ </values>
+ <tales>
+ </tales>
+ <messages>
+ <message name="external_validator_failed">मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</message>
+ <message name="required_not_found">मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</message>
+ <message name="too_long">मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</message>
+ </messages>
+ </field>
+ </fields>
+ </group>
+ </groups>
+</form>
+"""
+
+ # we're not expecting exceptions, and don't really care about anything
+ # else, so no asserts here...
+ form = ZMIForm('foo', 'Foo')
+ XMLToForm(xml1, form)
+ xml_roundtrip = formToXML(form)
+
+ xml1 = """\
+<?xml version="1.0"?>
+
+<form>
+ <title></title>
+ <row_length>4</row_length>
+ <name>testform_bugs</name>
+ <action></action>
+ <method>POST</method>
+ <enctype></enctype>
+ <encoding>UTF-8</encoding>
+ <stored_encoding>UTF-8</stored_encoding>
+ <unicode_mode>true</unicode_mode>
+ <i18n_domain></i18n_domain>
+ <groups>
+ <group>
+ <title>Default</title>
+ <fields>
+
+ <field><id>string</id> <type>StringField</type>
+ <values>
+ <alternate_name></alternate_name>
+ <css_class></css_class>
+ <default></default>
+ <description>मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</description>
+ <display_maxwidth></display_maxwidth>
+ <display_width type="int">20</display_width>
+ <enabled type="int">1</enabled>
+ <external_validator></external_validator>
+ <extra></extra>
+ <hidden type="int">0</hidden>
+ <max_length></max_length>
+ <required type="int">1</required>
+ <title>मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</title>
+ <truncate type="int">0</truncate>
+ <unicode type="int">0</unicode>
+ <whitespace_preserve type="int">0</whitespace_preserve>
+ </values>
+ <tales>
+ </tales>
+ <messages>
+ <message name="external_validator_failed">मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</message>
+ <message name="required_not_found">मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</message>
+ <message name="too_long">मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤, मà¥à¤à¥ à¤à¤¸ सॠà¤à¥à¤ पà¥à¤¡à¤¾</message>
+ </messages>
+ </field>
+ </fields>
+ </group>
+ </groups>
+</form>
+"""
+
+ # we're not expecting exceptions, and don't really care about anything
+ # else, so no asserts here...
+ form = ZMIForm('foo', 'Foo')
+ XMLToForm(xml1, form)
+ xml_roundtrip = formToXML(form)
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(SerializeTestCase, 'test'))
Modified: zope-formulator/branches/upstream/current/tests/test_validators.py
===================================================================
--- zope-formulator/branches/upstream/current/tests/test_validators.py 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/tests/test_validators.py 2006-11-09 09:44:30 UTC (rev 450)
@@ -180,6 +180,14 @@
'This is the string value',
self.v.deserializeValue(field, string)
)
+
+ def test_serializeNonStringValues(self):
+ not_a_string = 0
+ handler = FakeSaxProducer()
+ field = TestField('f', max_length=0, truncate=0, required=0, unicode=1)
+ self.v.serializeValue(field, not_a_string, handler)
+ self.assertEquals('0', handler.getXml())
+
class LinesValidatorTestVase(ValidatorTestCase):
Modified: zope-formulator/branches/upstream/current/version.txt
===================================================================
--- zope-formulator/branches/upstream/current/version.txt 2006-11-09 09:41:47 UTC (rev 449)
+++ zope-formulator/branches/upstream/current/version.txt 2006-11-09 09:44:30 UTC (rev 450)
@@ -1 +1 @@
-Formulator 1.9
+Formulator 1.11.2
More information about the pkg-zope-commits
mailing list