Pylons / deform

A Python HTML form library.
Other
417 stars 161 forks source link

Empty error message translated on sequence item #42

Closed hugobranquinho closed 13 years ago

hugobranquinho commented 13 years ago

On file "sequence_item.pt" if field.error.messages() comes with a false empty (equal to [None]), the empty message on locale file is returned like "Project-Id-Version: deform 0.0 Report-Msgid-Bugs-To: (...) By: Babel 0.9.6"

I change this code:

<p tal:condition="field.error and not field.widget.hidden" tal:define="errstr 'error-%s' % field.oid" tal:repeat="msg field.error.messages()" tal:attributes="id repeat.msg.index==0 and errstr or ('%s-%s' % (errstr, repeat.msg.index))" class="${field.widget.error_class}" i18n:translate="">${msg}</p>

To this:

<tal:c condition="field.error and not field.widget.hidden" define="errstr 'error-%s' % field.oid" repeat="msg field.error.messages()"> <p tal:condition="msg" tal:attributes="id repeat.msg.index==0 and errstr or ('%s-%s' % (errstr, repeat.msg.index))" class="${field.widget.error_class}" i18n:translate="">${msg}</p> </tal:c>

But maybe is better to fix the messages method on colander.

wichert commented 13 years ago

There is a pull request for this in ticket #44

mcdonc commented 13 years ago

Ticket 44 fixed.