Am Mittwoch, 7. Februar 2007 07:50 schrieb Jürgen Kartnaller: > Florian, > if you want the url to your current site implement this : > > > class SiteUrlView(object): > > def __call__(self): > return absoluteURL(hooks.getSite(), self.request) > > And register a page : > > <page > name="site_url" > for="*" > class=".views.SiteUrlView" > permission="zope.Public" > /> > > Now you can use context/@@site_url anywhere.
Hi, this works perfect when using it like: <a tal:attributes="href context/@@site_url">home</a> but when I try to directly link to a view registered with the object site_url returns: <a tal:attributes="href context/@@site_url/@@search.html">suche</a> (tried some variations of the above) it fails. How can I link to these views? Thanks, Florian the log message: File "/home/florian/Zope3/src/zope/tales/tales.py", line 696, in evaluate return expression(self) - /home/florian/Desktop/zope/lib/python/xgm/browser/skin/template.pt - Line 19, Column 18 - Expression: <PathExpr standard:u'context/@@site_url/@@search.html'> - Names: {'args': (), 'context': <xgm.xgm.XGM object at 0x966d0ac>, 'default': <object object at 0xb7c9a558>, 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': <zope.publisher.browser.BrowserRequest instance URL=http://localhost:8080/++skin++xgm/xgm/@@index.html>, 'template': <zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile object at 0x9169aac>, 'view': <zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /home/florian/Desktop/zope/lib/python/xgm/browser/skin/index.pt object at 0x96ca2cc>, 'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0x96ca2ec>} File "/home/florian/Zope3/src/zope/tales/expressions.py", line 217, in __call__ return self._eval(econtext) File "/home/florian/Zope3/src/zope/tales/expressions.py", line 194, in _eval ob = self._subexprs[-1](econtext) File "/home/florian/Zope3/src/zope/tales/expressions.py", line 124, in _eval ob = self._traverser(ob, element, econtext) File "/home/florian/Zope3/src/zope/app/pagetemplate/engine.py", line 68, in __call__ request=request) File "/home/florian/Zope3/src/zope/traversing/adapters.py", line 154, in traversePathElement return namespaceLookup(ns, nm, obj, request) - __traceback_info__: (<zope.app.publisher.browser.viewmeta.SiteUrlView object at 0x96ca48c>, '@@search.html') File "/home/florian/Zope3/src/zope/traversing/namespace.py", line 112, in namespaceLookup return traverser.traverse(name, ()) File "/home/florian/Zope3/src/zope/traversing/namespace.py", line 345, in traverse raise TraversalError(self.context, name) TraversalError: (<zope.app.publisher.browser.viewmeta.SiteUrlView object at 0x96ca48c>, 'search.html') 127.0.0.1 - - [08/Feb/2007:16:53:46 +0200] "GET /++skin++xgm/xgm HTTP/1.1" 500 89 "-" "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko)" _______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users