[ZPT] object located in in DTML but not ZPT

Ian Bicking ianb at colorstudy.com
Mon Dec 15 17:47:39 EST 2003


On Dec 15, 2003, at 4:44 PM, Jeremy Ryan wrote:
> Hi, I'm fairly new to Zope and am trying to learn to use ZPT rather 
> than
> DTML.
>
> I'm using a "Sequences" Product as a primary key generator. I have 
> created
> an instance of this called "pkGenerator" in the same folder as my page
> template. If I want to get the next sequence value I can call a DTML 
> method
> (called "sequencePuller") containing simply this:
>
>      <dtml-var "pkGenerator.getNextValue()">
>
> which works when called from the following line in a form on my 
> template:
>
>     <input type="hidden" name="pk" tal:define="primaryKey
> here/sequencePuller" tal:attributes="value string:$primaryKey" />
>
> This seems like an awful hack to me, and I'd like to do it in entirely 
> in
> TAL/TALES. I want to do something like:
>
>       <input type="hidden" name="pk" tal:attributes="value
> pkGenerator.getNextValue()" />
>

try:

<input type="hidden" name="pk" tal:attributes="value python: 
pkGenerator.getNextValue()" />

Or:

<input type="hidden" name="pk" tal:attributes="value 
pkGenerator/getNextValue" />

--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org




More information about the ZPT mailing list