[ZPT] absolute url of a page template

Florent Guillaume fg@nuxeo.com
Mon, 21 Oct 2002 18:57:04 +0000 (UTC)


Chris Withers  <chrisw@nipltd.com> wrote:
> Shane Hathaway wrote:
> >> absolute_url has a meaning for "objects", not "methods". And the
> >> PageTemplateFile you're using definitely looks like a method (that is, a
> >> View in Z3 terms).
> > 
> > You're right, but methods in Zope have URLs too. :-)  Notice the 
> > trailing slash... the problem is that the absolute_url() method thinks 
> > the PageTemplateFile has an empty string for an ID.  There is a 
> > collector issue for it.
> 
> http://collector.zope.org/Zope/620
> 
> My workaround is to do something icky in the class:
> 
>      # Templates
>      security.declareProtected(permissions.use,'issues')
>      issues = PageTemplateFile('templates/issues',globals())
>      issues.id='issues' # *sigh*

Isn't this what the __name__ argument is for?

 issues = PageTemplateFile('templates/issues', globals(), __name__='issues')

(untested...)

Florent
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com