While it looks the same it is not:
>>> formencode.api._stdtrans
<bound method GNUTranslations.ugettext of <gettext.GNUTranslations
instance at 0x00C63288>>
>>> pylons.decorators.formencode_gettext
<bound method NullTranslations.ugettext of <gettext.NullTranslations
instance at 0x00D405D0>>
In my opinion you shouldn't use this function directly. decorators
module exports only jsonify and validate functions. Use them.
That's how I solved validate problem:
from pylons.i18n import set_lang
class PeklaStateFactory(object):
def __call__(self):
set_lang('it')
formencode.api.set_stdtranslation(domain="FormEncode", languages=['it'])
return None
state_factory = PeklaStateFactory()
That's how you can use state_factory with tosca widgets validate:
@validate(form=banner_form, error_handler='edit', state_factory=state_factory)
Pylons validate should use state (not state_factory) but I have not tested that.
--
Dalius
http://blog.sandbox.lt