On Fri, Mar 16, 2001 at 04:59:16PM -0000, Phil Harris wrote:
> All,
> I'm in the process of trying out the ZPT stuff(thanks to Duncan Booth for
> the win32 stuff).
> Anyway up, It's all going according to plan but I have a few issues, maybe
> someone has a better idea than me what's wrong here.
> <code starts here>
> <?xml version="1.0" ?>
> <html xmlns:tal="http://xml.zope.org/namespaces/tal"
>       xmlns:metal="http://xml.zope.org/namespaces/metal">
>   <head>
>     <title tal:insert="here/title">The title</title>
>   </head>
>   <body>
>     <h2 tal:insert="here/title_or_id">the title</h2>
>     <div tal:define="ui python:container.userInfo()">
>       <b tal:replace="python:ui['dn']">crap</b>
>       <b tal:replace="python:ui['sn']">crap</b>
>       <b tal:replace="python:ui['cn']">crap</b>
>     </div>
>     <hr />
>     <a href="index_html">click here to refresh</a>
>   </body>
> </html>
> </code ends here>
> The problem is that I'm getting a traceback (I won't bore you with the
> details unless I have to) to the effect of 'ui' being unknown.
> If I replace the 'div' in the code above with:
> <b tal:replace="python:container.userInfo()['dn']">crap</b>
> <b tal:replace="python:container.userInfo()['sn']">crap</b>
> <b tal:replace="python:container.userInfo()['cn']">crap</b>
> then all works according to design, but with a lot more overhead.
> btw, the userInfo method returns a dictionary of LDAP information, it works
> in all other contexts, so I don't think the problem is there.

As Ethan said, the release you are using doesn't yet support access to
defined variables in python.

Instead, try the following:

  <div tal:define="ui python:container.userInfo()">
    <b tal:replace="ui/dn">crap</b>
    <b tal:replace="ui/sn">crap</b>
    <b tal:replace="ui/cn">crap</b>

It will be much more readable, and it removes a layer of interpretation

Martijn Pieters
| Software Engineer  mailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to