Re: Metadata and the Catalog

Andy Altepeter <[email protected]>
Newsgroups gmane.comp.web.zope.silva.devel
Organization Bethel University
Message-ID <[email protected]>
On Friday 30 March 2007 12:13, eric casteleijn wrote:
> This message is mainly to keep myself forgetting all about this, and
> since the issue tracker is temporarily frozen, and a little discussion
> would be nice anyway, I thought I'd post my findings here.
>
> There appears to be another small problem with the method:
>
> SilvaMetadata.MetadataTool.getMetadataValue()
>
> in that it returns the default value of a metadata field for objects
> that don't have that metadata field, or even the metadataset it's from,
> defined on them! This is not good: I'd really rather have it raise a
> KeyError, to show that this metadata value doesn't exist. One of the
> downsides of returning the default value instead of a key error, is that
> that value gets indexed, whereas it really shouldn't, because we now
> find content objects in some searches on a particular index of a field
> that those objects do not even have.
>
> What I'd like to do is change the code, so that it does raise the
> KeyError in the case the metadata set doesn't exist for the object. (And
> only in that case, when it's just the value that's missing, of course we
> *do* want the default value returned.)
>
> What I'd like to know, are there extension developers out there who
> would be inconvenienced by this? In other words: would your code break
> if getMetadataValue potentially raises KeyErrors?

Hey Eric,

I think this change "is a good thing".  I suppose you'll be implementing it in 
the trunk or some other.  Extension developers are already needing to do many 
adjustments to their code in order to upgrade extensions to recent versions, 
and each new version requires a bit more adjustment as more of Silva is 
converted to use Five.  So, what's one more adjustment?  As long as we're 
aware of this...

Since we're on the topic of SilvaMetadata, I do find one thing annoying:
When the a value of a listfield is changed (say the value was a typo, or 
instead of an empty '' you decide to use the string ' none'), any silva 
object which has that metdata element set to that particular value is now 
broken.  This is annoying, because there is no quick or easy way to fix these 
objects, short of an upgrade script.

But I digress...

Well, +1 for me.

Andy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.