tg_errors

23 views
Skip to first unread message

Glauco

unread,
Jun 18, 2012, 9:32:26 AM6/18/12
to turbo...@googlegroups.com
Hi all i've a strange behaviour showing errors in template.



I've this:

class Controller1(object):
@tg.expose( template="base" )
@tg.identity.require( .. )
@check_environment
def index(self, tg_errors=None, **kw):
if tg_errors:
print tg_errors

@tg.expose()
@tg.identity.require( tg.identity.not_anonymous() )
@tg.validate( form=_form )
@tg.error_handler(index)
@check_environment
def save(self, **kw):
...


class Controller2(Controller1):
# index and save are inherited from Controller1



All validations work perfectly , tg_errors are correctly passed to
controller ( the print is ok for each controller) .
But in the controller2 the error_for functions inside genshi don't work.



any ideas?
Thank you
Gla



Il contenuto di questa e-mail è rivolto unicamente alle persone alle quali è indirizzato e può contenere informazioni la cui riservatezza è tutelata legalmente. Sono vietati la riproduzione, la diffusione e l’uso di questa e-mail in mancanza di autorizzazione del destinatario. Se avete ricevuto questa e-mail per errore vogliate cortesemente contattarci immediatamente.

This e-mail is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorised reproduction, dissemination or use of this e-mail or of the information herein by anyone other than the intended recipient is prohibited. If you have received this e-mail by mistake, please notify us immediately.

Moritz Schlarb

unread,
Jun 20, 2012, 4:26:30 AM6/20/12
to turbo...@googlegroups.com
Glauco, is that TurboGears 1 you're using?

Glauco

unread,
Jun 20, 2012, 5:23:23 AM6/20/12
to turbo...@googlegroups.com
Il 20/06/2012 10:26, Moritz Schlarb ha scritto:
> Glauco, is that TurboGears 1 you're using?


Yes...

i found the problem (and it is very strange).


I've 2 controllers that expose the same form:

the form is like:


form = TableForm( fields=[...],
validator=Schema(),
template="...",
action='save')


If i define a new form IDENTICAL to that one:
form2 = TableForm( fields=[...],
validator=Schema(),
template="...",
action='save')

The validation is correct but no error are showed.

i've solved doing this:

form2=form

but i'm not sure if this is correct.




Glauco
Reply all
Reply to author
Forward
0 new messages