Using a ZCLass property as TALES expression ?
Hi, I'm actually building a ZClass for which some validation rules may be customized object per object. I think that using a TALES expression for that purpose may be a good idea, but I can't find a way to execute a TALES expression in the context of the current object, and get the result. Any idea ? Thanks in advance. --Gilles
Gilles Lenfant wrote:
I think that using a TALES expression for that purpose may be a good idea, but I can't find a way to execute a TALES expression in the context of the current object, and get the result.
Any idea ?
See http://www.zopelabs.com/cookbook/1029970670 Cheers, Evan @ 4-am
Gilles Lenfant writes:
I'm actually building a ZClass for which some validation rules may be customized object per object. I think that using a TALES expression for that purpose may be a good idea, but I can't find a way to execute a TALES expression in the context of the current object, and get the result. I do not know of a "TTW" (Through The Web) way to evaluate a TALES expression (given as a string) in a given context.
Of course, you can do it in an External Method. You will find several examples in the CMF (e.g. "ActionProviderBase", "DCWorkflow"). Dieter
----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Gilles Lenfant" <gilles@pilotsystems.net> Cc: <zope@zope.org> Sent: Friday, September 06, 2002 8:24 PM Subject: Re: [Zope] Using a ZCLass property as TALES expression ?
Gilles Lenfant writes:
I'm actually building a ZClass for which some validation rules may be customized object per object. I think that using a TALES expression for that purpose may be a good idea, but I can't find a way to execute a TALES expression in the context of the current object, and get the result. I do not know of a "TTW" (Through The Web) way to evaluate a TALES expression (given as a string) in a given context.
Of course, you can do it in an External Method. You will find several examples in the CMF (e.g. "ActionProviderBase", "DCWorkflow").
Dieter
Many thanks Dieter, I'm gonna look at these codes to get enlightenments. IMHO, it would be a good idea to have this feature directly available from a TTW Python script in a future Zope, when TALES expression are supposed to be executed in a "secure" manner. talesExpr = TalesCompile(aStringTALESexpression) ... result = talesExpr.execute(context, REQUEST) But perhaps I'm writing something silly :)) Cheers --Gilles
----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Gilles Lenfant" <gilles@pilotsystems.net> Cc: <zope@zope.org> Sent: Friday, September 06, 2002 8:24 PM Subject: Re: [Zope] Using a ZCLass property as TALES expression ?
Gilles Lenfant writes:
I'm actually building a ZClass for which some validation rules may be customized object per object. I think that using a TALES expression for that purpose may be a good idea, but I can't find a way to execute a TALES expression in the context of the current object, and get the result. I do not know of a "TTW" (Through The Web) way to evaluate a TALES expression (given as a string) in a given context.
Of course, you can do it in an External Method. You will find several examples in the CMF (e.g. "ActionProviderBase", "DCWorkflow").
Dieter
Many thanks Dieter, I'm gonna look at these codes to get enlightenments. IMHO, it would be a good idea to have this feature directly available from a TTW Python script in a future Zope, when TALES expression are supposed to be executed in a "secure" manner. talesExpr = TalesCompile(aStringTALESexpression) ... result = talesExpr.execute(context, REQUEST) But perhaps I'm writing something silly :)) Cheers --Gilles
participants (3)
-
Dieter Maurer -
Evan Simpson -
Gilles Lenfant