I see. From the top of my head you can:
1) Forsake error handlers and depending on tg_errors make the call
"manually".
2) Use a proxy error handler:
def proxy(self, tg_errors, *args, *kw):
kw["add"] = True
kw["tg_errors"] = tg_errors
self.clients(*args, **kw)
@turbogears.expose()
...
@turbogears.error_handler(proxy)
def save(self, cliente_id, **kword):
# (...)
3) Do something nasty with nested functions.
Unfortunately neither of these solutions is elegant. Personally I would
go with 2).
Cheers,
Simon
Jorge Godoy wrote:
Simon Belak <[EMAIL PROTECTED]> writes:
I am afraid I don't follow. Could you explain a bit further please.
Probably a misdesign of mine, but:
@turbogears.expose(html="siteamostras.templates.clientes")
@identity.require(identity.conditions.in_any_group('XXX_ver',
'XXX_atualizar', 'XXX_deletar', 'XXX_novo',
'admin'))
def clientes(self, cliente_id, add = False, tg_errors = None):
# (...)
@turbogears.expose()
@turbogears.validate(form = formulario_clientes)
@turbogears.error_handler(clientes)
@identity.require(identity.conditions.in_any_group('XXX_novo', 'admin'))
def save(self, cliente_id, **kword):
# (...)
@turbogears.expose()
@turbogears.validate(form = formulario_clientes)
@turbogears.error_handler(clientes)
@identity.require(identity.conditions.in_any_group('XXX_atualizar',
'admin'))
def update(self, cliente_id, **kword):
# (...)
How can I make 'save' and 'update' send the correct value for 'add' here? It
should be 'True' for 'save' and 'False' for update.