[Zope] python expression in tal:attributes

Ferhat Ayaz ferhatayaz at yahoo.com
Wed Aug 30 09:26:28 EDT 2006


Thanks to all. Now I extracted the links to a python
script like

url = container.Site.absolute_url()
return {
 url+'/Catalog/index.html': 'Catalog',
 url+'/Members/index.html': 'Members',
 url+'/Orders/index.html': 'Orders',
}.items()

and this works fine. index.html was just an example.
I'll change the link names. 
But I'm still not so happy with this solution because
I must change the line

url = container.Site.absolute_url()

to 

url = container.<my-site-root>.absolute_url()

later after productive installation. 

Greets,
Ferhat


--- Jens Vagelpohl <jens at dataflake.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> On 30 Aug 2006, at 14:40, Ferhat Ayaz wrote:
> 
> > but my site root is /Site and not /, which can be
> > changed later.
> > Should I define this as a variable, or is there a
> > better way?
> 
> Yes there is. Ditch hardcoded strings and ask the
> objects themselves  
> for their path. So in your code you could say...
> 
> Site.absolute_url()
> 
> instead of "/" or "/Site", because it will do the
> right thing with  
> virtual hosting.
> 
> jens
> 
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Darwin)
> 
>
iD8DBQFE9YhMRAx5nvEhZLIRApbJAJ4x+iwpT68gyBIfpBCIQmRTrrJWgQCgpyH4
> JIRjVtOC/Y8sCas6ffvDYRs=
> =UfE6
> -----END PGP SIGNATURE-----
> _______________________________________________
> Zope maillist  -  Zope at 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 )
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Zope mailing list