[Zope-dev] ZPT trials and tribulations

2001-03-16 Thread Phil Harris

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.

Anyone got any ideas?

Phil
[EMAIL PROTECTED]




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



Re: [Zope-dev] ZPT trials and tribulations

2001-03-16 Thread Evan Simpson

From: "Phil Harris" [EMAIL PROTECTED]
 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.

Mmph.  That release has a problem with exposing TAL variables to Python
code.  There will be a *much* better one Real Soon Now.

Cheers,

Evan @ digicool


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



Re: [Zope-dev] ZPT trials and tribulations

2001-03-16 Thread Martijn Pieters

On Fri, Mar 16, 2001 at 04:59:16PM -, 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
  /div

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

-- 
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]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )