On Wed, Jan 02, 2008 at 02:44:24PM -0400, Victor Subervi wrote:
> Hi;
> I have this in a page template:
> 
> <html>
> <body>
> <table>
>  <tr>
>   <td tal:define="num python:here.scripts.getQuote">
>    <span metal:use-macro="here/en-us/quotes/?num/macros/quote" /><br />
>    <div align="center">
>     <span class="text">
>      <a href="quotes.pt" target="_top"><b>The quotes</b></a>
>     </span>
>    </div>
>   </td>
>  </tr>
> </table>
> </body>
> <html>
> 
> Now, I thought that was the correct way to call the variable "num" (that is,
> with the question mark: "?num"). Apparently, I'm mistaken. I've even tried
> defining it this way:

I didn't see a followup on this post, so I thought I would add my
ignorance to the discussion.

first, I don't think you can assign a variable name to a python
function using tal and then have tal 'call' the function.

second, I think what you do want is the get the results of calling
getQuote into the variable called 'num', and then use those results
elsewhere.

I think tal variables can all be first class python objects. If not,
any standard python object works -- in other words, a list, tupple,
string, dictionary, etc. If you have your own object, it will need to
have an iterator method defined for it -- but then, I wouldn't know
how to make the new class known to zope.


> 
>   <td tal:define="num python:str(11)">
> to make sure that num was properly assigned. What am I missing? Also, if I
> have a dir called "scripts" in which "getQuote" exists, and "scirpts" is in
> the path, shouldn't that notation work okay?

acquisition will find many things. What does getQuote return though?

> TIA,
> Victor

> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )


-- 
David Bear
phone:  602-496-0424
fax:    602-496-0955
College of Public Programs/ASU
University Center Rm 622
411 N Central
Phoenix, AZ 85007-0685
 "Beware the IP portfolio, everyone will be suspect of trespassing"
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to