Re: [Zope] Puzzled re ZCatalog and Zope.org /SiteIndex
On Wed, 3 Nov 1999 08:16:23 -0500, Mike Pelletier wrote:
Jeff Rush <jrush@timecastle.net> travelled for many days to ask:
[1] Some areas I'm having trouble on are the metadata and index fields used in DTML that accesses the SiteIndex zcatalog object. They use search fields like 'date', 'url', 'title_or_id' and 'text_content' which
don't
exist in a default zcatalog instance. I can add them via the management interface and re-catalog the site but nothing ever shows up in those index fields. Is Zope.org using some pluggable-brain technology to wrap a zcatalog and provide these attributes on normal, unchanged objects like DTML Documents and DTML Methods?
No, it is a completely plain-jane ZCatalog. Those are external methods. In the cases of the Z Classes, they are members of the class. Vanilla Zope objects like DTML Documents are acquiring those methods from a parent folder.
Hmmm, I don't quite understand. Are you saying that ya'll created and placed in the root folder, say, an external method named 'date' that does the equivalent of the following in a DTML Method <dtml-return bobobase_modification_time> And then you added a field called 'date' to the ZCatalog metadata and index tabs? This seems to work here with a DTML Method -- why was an external method necessary? Also doesn't this mean that the ZCatalog instance is duplicating data, storing the date under both the 'bobobase_modification_time' (for backward compatibility) and 'date' columns? This seems like a bit of overhead just to be able to use the shorter name in search DTML, or am I missing the benefit/intent? {also to construct the 'url' attribute, how did you obtain the url of an arbitrary object -- the generic Zope equivalent of "getpath(record_id)"?} -Jeff Rush
At 16:21 03/11/99 , Jeff Rush wrote:
Hmmm, I don't quite understand. Are you saying that ya'll created and placed in the root folder, say, an external method named 'date' that does the equivalent of the following in a DTML Method
<dtml-return bobobase_modification_time>
And then you added a field called 'date' to the ZCatalog metadata and index tabs?
This seems to work here with a DTML Method -- why was an external method necessary?
Because Catalog doesn't call DTML Methods with the usual context, so the can't determine what to call bobobase_modification_time on.
Also doesn't this mean that the ZCatalog instance is duplicating data, storing the date under both the 'bobobase_modification_time' (for backward compatibility) and 'date' columns? This seems like a bit of overhead just to be able to use the shorter name in search DTML, or am I missing the benefit/intent?
Date is a clearer name. Also no duplication is necessary, just remove the bobobase_modification_time column.
{also to construct the 'url' attribute, how did you obtain the url of an arbitrary object -- the generic Zope equivalent of "getpath(record_id)"?}
absolute_url() -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Jeff Rush <jrush@timecastle.net> wrote:
[1] Some areas I'm having trouble on are the metadata and index fields used in DTML that accesses the SiteIndex zcatalog object. They use search fields like 'date', 'url', 'title_or_id' and 'text_content' which don't exist in a default zcatalog instance. I can add them via the management
No, it is a completely plain-jane ZCatalog. Those are external methods. In the cases of the Z Classes, they are members of the class. Vanilla Zope objects like DTML Documents are acquiring those methods from a parent folder.
Hmmm, I don't quite understand. Are you saying that ya'll created and placed in the root folder, say, an external method named 'date' that does the equivalent of the following in a DTML Method
<dtml-return bobobase_modification_time>
And then you added a field called 'date' to the ZCatalog metadata and index tabs?
Yes.
This seems to work here with a DTML Method -- why was an external method necessary?
Good question. It was there when I got here. ;-) It's probably faster.
Also doesn't this mean that the ZCatalog instance is duplicating data, storing the date under both the 'bobobase_modification_time' (for backward compatibility) and 'date' columns? This seems like a bit of overhead just to be able to use the shorter name in search DTML, or am I missing the benefit/intent?
I think 'date' was chosen to make the SiteIndex conform to a specific spec, which I don't know anything about. I'm going to have to leave these questions to Amos, who (I think!) did most the SiteIndex and external method stuff.
{also to construct the 'url' attribute, how did you obtain the url of an arbitrary object -- the generic Zope equivalent of "getpath(record_id)"?}
Here is the code behind url. Hopefully Outlook Express won't mangle it beyond recognition. 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'] if script_name: uri=filter(None, string.split(uri, script_name))[0] uri=uri or '/' if uri[0]=='/': uri=uri[1:] return uri
-Jeff Rush
Mike.
participants (3)
-
Jeff Rush -
Martijn Pieters -
Mike Pelletier