[ZCM] [ZC] 1884/ 6 Comment "cannot iterate catalog brains when sort is defined"
"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Fri, 25 May 2007 04:03:44 -0400
| Newsgroups | gmane.comp.web.zope.devel.collector-monitor |
|---|---|
| Message-ID | <[email protected]> |
Issue #1884 Update (Comment) "cannot iterate catalog brains when sort is defined"
Status Pending, Zope/bug medium
To followup, visit:
http://www.zope.org/Collectors/Zope/1884
==============================================================
= Comment - Entry #6 by jjozsef on May 25, 2007 4:03 am
Workaround: patch your zope by adding this to SOFTWARE_HOME/lib/python/Products/ZCatalog/CatalogBrains?.py AbstractCatalogBrain class:
def __cmp__(self, other): return 0
source: http://zwiki.org/1145MybrainsCmpErrorWithRecentChangesSearchOnZope28
________________________________________
= Comment - Entry #5 by efge on Feb 16, 2006 9:22 am
See also http://www.zope.org/Collectors/Zope/2026
________________________________________
= Comment - Entry #4 by simon on Feb 7, 2006 7:23 pm
This problem still exists in 2.9.0, and can be worked around by the same patch.
I reproduce it with <dtml-in pages sort=creation_time></dtml-in> in a zwiki page. pages returns a list of catalog brains, the creation_time attribute is a string.
________________________________________
= Comment - Entry #3 by simon on Sep 6, 2005 2:40 am
Adding this to Products.ZCatalog.CatalogBrains.AbstractCatalogBrain fixes the crash::
def __cmp__(self, other): return 0
Brains don't need to be sortable in the situation below. I don't know if that's always true though.
________________________________________
= Comment - Entry #2 by simon on Sep 1, 2005 8:44 pm
In case it helps: I get this with Zope 2.8.1 at DT_In.py line 783 when doing < dtml-in results sort=lastEditTime ... >. It worked with Zope 2.7. The list s at that point looks like:
(Pdb) for i in U: print i
(DateTime('2004/10/29 13:09:28 GMT-7'), <Products.ZCatalog.Catalog.mybrains object at 0x423acbe4>)
(DateTime('2004/11/18 12:36:56 US/Pacific'), <Products.ZCatalog.Catalog.mybrains object at 0x423acb44>)
...
I get the same error when comparing two of these brains, eg:
(Pdb) b1 < b2
*** TypeError: mybrains.__cmp__(x,y) requires y to be a 'mybrains', not a 'ImplicitAcquirerWrapper'
________________________________________
= Request - Entry #1 by kedai on Sep 1, 2005 4:00 am
Uploaded: "test.zexp"
- http://www.zope.org/Collectors/Zope/1884/test.zexp/view
attached is a minimal setup (zexp)
import to zope instance, try view test. all shoud be ok
try testsort .. we'll get
Error Type: TypeError
Error Value: mybrains.__cmp__(x,y) requires y to be a 'mybrains', not a 'ImplicitAcquirerWrapper'
the only difference is the sort='something' in dtml-in
tq
==============================================================