Shane Hathaway wrote:
> 
> Steve Alexander wrote:
> > In lib/python/Products/ZCatalog/CatalogAwareness.py, the method "url":
> >
> >     def url(self, ftype=urllib.splittype, fhost=urllib.splithost):
> >         """Return a SCRIPT_NAME-based url for an object."""
> >         if hasattr(self, 'DestinationURL') and \
> >            callable(self.DestinationURL):
> >             url='%s/%s' % (self.DestinationURL(), self.id)
> >         else: url=self.absolute_url()
> >         type, uri=ftype(url)
> >         host, uri=fhost(uri)
> >         script_name=self.REQUEST['SCRIPT_NAME']
> >         __traceback_info__=(`uri`, `script_name`)
> >         if script_name:
> >             uri=filter(None, string.split(uri, script_name))[0]
> > *       if uri[0] != '/': uri = '/' + uri
> > *       uri=uri or '/'
> >         return urllib.unquote(uri)
> >
> > I'm suspicious of the two lines marked with a "*".
> 
> I was suspicious of the entire method so I wrote a replacement which is
> based on a new interface available in Zope.  I *think* it's correct,
> but it's a drastic change so it's only in the new PTK and nowhere
> else.  (This is slightly modified from PTK CVS.)
> 
>     def __url(self):
>         return string.join(self.getPhysicalPath(), '/')

That certainly looks a lot cleaner and more obvious.

Does it work with SiteAccess?

What's with all the DestinationURL stuff in the original url method?

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

_______________________________________________
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 )

Reply via email to