7 messages in com.googlegroups.pylons-discussFormEncode and field name in error di...
FromSent OnAttachments
Yves-Eric25 Feb 2007 21:54 
Max Ischenko26 Feb 2007 03:52 
Yves-Eric26 Feb 2007 04:43 
Yves-Eric26 Feb 2007 16:45 
Max Ischenko27 Feb 2007 03:08 
Yves-Eric27 Feb 2007 22:50 
Shannon -jj Behrens28 Feb 2007 18:41 
Subject:FormEncode and field name in error display
From:Yves-Eric (yema@public.gmane.org)
Date:02/25/2007 09:54:21 PM
List:com.googlegroups.pylons-discuss

Hi all,

I am localizing an app that uses FormEncode in the way described in the Pylons "form hadling" documentation, under "Validation the long way". I can already localize the error message using something like the following:

messages = { 'missingValue': 'Please select at least one.', }

class InvoiceSearchForm(formencode.Schema):

ptypes = formencode.validators.NotEmpty(messages=messages) itypes = formencode.validators.NotEmpty(messages=messages) pstates = formencode.validators.NotEmpty(messages=messages) sstates = formencode.validators.NotEmpty(messages=messages)

My problem is that the field name is used in the error display. For example, with missing "itypes", I get the following error:

itypes: Please select at least one.

I would like to display a meaningful name instead of the field internal name. Is there a ways to do that easily? It would be great if I could do something like declaring in the schema:

itypes = formencode.validators.NotEmpty(name="Invoice types", messages=messages)

but I haven't found a way yet.

Any help would be greatly appreciated.

(PS: I am localizing an app to Japanese, to just using more meaningful field names is not an option ^^ )

Cheers,