[Zope-dev] URL quoting, '/' problems with ZCatalog

Itamar Shtull-Trauring itamars@ibm.net
Sun, 16 Jan 2000 16:14:58 +0200


(This is going into the Collector too.)

I've been working extensively with the ZCatalog in the past few weeks, using
it to link to cataloged object using REQUEST.resolve_url(BASE0 +
catalog.getpath(data_record_id_)).  Along the way I've encountered a number
of problems that have come up here on the list, mainly with people complaing
about "Uncatalog of absent id".  I'm running Zope 2.1.0 and 2.1.1.

1. Find Items to ZCatalog vs. IndexAware:
Finf and IndexAware index object in the ZCatalog.  The problem is that they
do it using completely different formats.
Find creates ZCatalog entries with a / in the beginning, and not url_quoted.
IndexAware creates ZCatalog entries without a / in the beginning, and
url_quoted.

For example, the following object /A Folder/an object will be cataloged two
ways
using Find:       /A Folder/an object
using IndexAware:  A%20Folder/an%20object

2. REQUEST.resolve_url will only accept non url-quoted URLs, so if you want
to use the result of a ZCatalog search on IndexAware objects you'll need to
unurlquote them.  ZCatalog.getobject uses REQUEST.resolve_url, so I assume
it will also break on IndexAware objects.  You have to pass a full URL for
some reason, too - http://zope:8080/index_html, instead of /index_html.


The problem here is that Zope does not define what format an URL should be
in.  I propose that the standard format be unurl_quoted (spaces, not %20)
with a '/' in the beginning, but the other way around is okay as long as
there is a STANDARD.  Is it too late to fix REQUEST.resolve_url, or is there
some good reason that I need to prepend BASE0 every time I call it?

-- 
Itamar S.T.  itamars@ibm.net