[ZCM] [ZC] 1816/ 2 Reject "ZCTextIndex: index_object() can no
longer handle attributes returning lists of strings"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Tue Jun 21 12:13:29 EDT 2005
Issue #1816 Update (Reject) "ZCTextIndex: index_object() can no longer handle attributes returning lists of strings"
Status Rejected, Catalog/bug+solution critical
To followup, visit:
http://www.zope.org/Collectors/Zope/1816
==============================================================
= Reject - Entry #2 by ajung on Jun 21, 2005 12:13 pm
Status: Pending => Rejected
Dupe of 1815
________________________________________
= Request - Entry #1 by sacco on Jun 21, 2005 12:03 pm
ZCTextIndex/ZCTextIndex.py was updated to fix handling of multiple attributes (Collector #1784), checked in by Andreas Jung 2005-05-17.
Various changes were made to index_object, although it looks as if changing one line in _index_object() would have been enough:
- text = getattr(obj, self._fieldname, None)
+ text = getattr(obj, attr, None)
However, the new version ends of index_object() with:
if all_texts:
return self.index.index_doc(documentId, ' '.join(all_texts))
which breaks if any attr has returned a list of strings, behaviour which seems to be allowed for by the index_doc() function called.
I suspect that what was intended was something more like the following (but I'm just typing this into the browser here, so it should be checked):
if all_texts:
all_text = list()
for txt in all_texts:
if isinstance(txt, (list, tuple, )):
all_text.extend(txt)
elif isinstance(txt, basestring):
all_text.append(txt)
return self.index.index_doc(documentId, all_text)
...unless there was some other reason why the original _index_object was used to make each call to index_doc() separately (I don't know the modules well enough to have an opinion here).
==============================================================
More information about the Zope-Collector-Monitor
mailing list