[Zope-dev] bug in CatalogAwareness?
Shane Hathaway
shane@digicool.com
Thu, 24 Aug 2000 11:14:45 -0400
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(), '/')
Shane