Metadata and the Catalog
eric casteleijn <[email protected]>
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Message-ID | <[email protected]> |
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? -- - eric casteleijn http://infrae.com