Acquisition/cDocumentTemplate bug
Recently, several posters have reported strange "AttributeError __call__" exceptions. The most precise was a report by Oleg Broytmann: /index_html DTML Document <dtml-var standard_html_header> /standard_html_header DTML Method <dtml-with sub></dtml-with> /sub Folder When he calls "/sub/index_html", he gets this "AttributeError __call__" for "sub". He observed the problem on Zope 2.1.4 and 2.2a4. I partially analysed this problem report under Zope 2.1.6: In "MM_cget", "sub" is retrieved as an "ImplicitAcquirerWrapper" (correct). In line 373, however, "PyCallable_Check(sub)" returned "1", which is probably wrong, because a folder is not callable. The "ImplicitAcquirerWrapper"'s "tp_call" mislead "PyCallable_Check". In line 376, the attribute "py_isDocTemp" is looked up and succeeds. Therefore, the folder "sub" is seen as a Document Template, which definitely is not true. The following call fails because it arrives at CallMethodO in "Acquisition.c:119" which looks for a non-excisting "__call__" method. Dieter
Brian, This is an excellent bug analysis. I suggest that we create a new PyCallable_Check function that works in the presence of wrappers, perhaps called PyCallable_CheckW(). If it is placed in Acquisition.c then cDocumentTemplate.c will have to #include "Acquisition.h". Then we need to replace PyCallable_Check in probably more than just cDocumentTemplate. Shane Dieter Maurer wrote:
Recently, several posters have reported strange "AttributeError __call__" exceptions.
The most precise was a report by Oleg Broytmann:
/index_html DTML Document <dtml-var standard_html_header> /standard_html_header DTML Method <dtml-with sub></dtml-with> /sub Folder
When he calls "/sub/index_html", he gets this "AttributeError __call__" for "sub".
He observed the problem on Zope 2.1.4 and 2.2a4.
I partially analysed this problem report under Zope 2.1.6:
In "MM_cget", "sub" is retrieved as an "ImplicitAcquirerWrapper" (correct).
In line 373, however, "PyCallable_Check(sub)" returned "1", which is probably wrong, because a folder is not callable. The "ImplicitAcquirerWrapper"'s "tp_call" mislead "PyCallable_Check".
In line 376, the attribute "py_isDocTemp" is looked up and succeeds. Therefore, the folder "sub" is seen as a Document Template, which definitely is not true. The following call fails because it arrives at CallMethodO in "Acquisition.c:119" which looks for a non-excisting "__call__" method.
Dieter
Hi! Anyone is working on it? Should I put this into Collector or Tracker? On Mon, 17 Jul 2000, Shane Hathaway wrote:
This is an excellent bug analysis. I suggest that we create a new PyCallable_Check function that works in the presence of wrappers, perhaps called PyCallable_CheckW(). If it is placed in Acquisition.c then cDocumentTemplate.c will have to #include "Acquisition.h". Then we need to replace PyCallable_Check in probably more than just cDocumentTemplate.
Shane
Dieter Maurer wrote:
Recently, several posters have reported strange "AttributeError __call__" exceptions.
The most precise was a report by Oleg Broytmann:
/index_html DTML Document <dtml-var standard_html_header> /standard_html_header DTML Method <dtml-with sub></dtml-with> /sub Folder
When he calls "/sub/index_html", he gets this "AttributeError __call__" for "sub".
He observed the problem on Zope 2.1.4 and 2.2a4.
I partially analysed this problem report under Zope 2.1.6:
In "MM_cget", "sub" is retrieved as an "ImplicitAcquirerWrapper" (correct).
In line 373, however, "PyCallable_Check(sub)" returned "1", which is probably wrong, because a folder is not callable. The "ImplicitAcquirerWrapper"'s "tp_call" mislead "PyCallable_Check".
In line 376, the attribute "py_isDocTemp" is looked up and succeeds. Therefore, the folder "sub" is seen as a Document Template, which definitely is not true. The following call fails because it arrives at CallMethodO in "Acquisition.c:119" which looks for a non-excisting "__call__" method.
Dieter
Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
Oleg Broytmann wrote:
Anyone is working on it? Should I put this into Collector or Tracker?
Already there. The Zope project manager is gone for the week. Shane
On Mon, 17 Jul 2000, Shane Hathaway wrote:
This is an excellent bug analysis. I suggest that we create a new PyCallable_Check function that works in the presence of wrappers, perhaps called PyCallable_CheckW(). If it is placed in Acquisition.c then cDocumentTemplate.c will have to #include "Acquisition.h". Then we need to replace PyCallable_Check in probably more than just cDocumentTemplate.
Does anyone know of any progress on this bug its marked as "pending" in the Collector, so I guess not. http://classic.zope.org:8080/Collector/1441/view ----- Original Message ----- From: "Shane Hathaway" <shane@digicool.com> To: <phd@phd.russ.ru> Cc: <zope-dev@zope.org> Sent: Thursday, July 20, 2000 6:29 AM Subject: Re: [Zope-dev] Acquisition/cDocumentTemplate bug
Oleg Broytmann wrote:
Anyone is working on it? Should I put this into Collector or Tracker?
Already there. The Zope project manager is gone for the week.
Shane
On Mon, 17 Jul 2000, Shane Hathaway wrote:
This is an excellent bug analysis. I suggest that we create a new PyCallable_Check function that works in the presence of wrappers, perhaps called PyCallable_CheckW(). If it is placed in Acquisition.c then cDocumentTemplate.c will have to #include "Acquisition.h". Then we need to replace PyCallable_Check in probably more than just cDocumentTemplate.
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Sorry ignore me, I thought I was being bitten by this bug, but Im not. It was the old difference between <dtml-with foo> and <dtml-with "foo"> in someone else's dtml. ----- Original Message ----- From: "Andy McKay" <andy@agmweb.bc.ca> To: <zope-dev@zope.org> Sent: Thursday, October 05, 2000 1:07 PM Subject: Re: [Zope-dev] Acquisition/cDocumentTemplate bug
Does anyone know of any progress on this bug its marked as "pending" in the Collector, so I guess not.
http://classic.zope.org:8080/Collector/1441/view
----- Original Message ----- From: "Shane Hathaway" <shane@digicool.com> To: <phd@phd.russ.ru> Cc: <zope-dev@zope.org> Sent: Thursday, July 20, 2000 6:29 AM Subject: Re: [Zope-dev] Acquisition/cDocumentTemplate bug
Oleg Broytmann wrote:
Anyone is working on it? Should I put this into Collector or Tracker?
Already there. The Zope project manager is gone for the week.
Shane
On Mon, 17 Jul 2000, Shane Hathaway wrote:
This is an excellent bug analysis. I suggest that we create a new PyCallable_Check function that works in the presence of wrappers, perhaps called PyCallable_CheckW(). If it is placed in
Acquisition.c
then cDocumentTemplate.c will have to #include "Acquisition.h". Then we need to replace PyCallable_Check in probably more than just cDocumentTemplate.
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
If there a way to get ZCatalog to give me intersections of results on a single index? All the examples and tutorials I've seen are union (OR) queries. Basically I just want ZCatalog to give me items where keywords contained both 'foo' and 'bar'. I have browsed through Catalog.py and it seems like it might be possible. Disclaimer, I'm pretty new to Zope & python. -- Neil Kandalgaonkar <NeilK@ActiveState.com> Web Application Developer, ActiveState
Neil K wrote:
If there a way to get ZCatalog to give me intersections of results on a single index? All the examples and tutorials I've seen are union (OR) queries.
Basically I just want ZCatalog to give me items where keywords contained both 'foo' and 'bar'.
You should use a Keyword Index for this. If your KW index was named 'food' and all your objects had a 'food' sequence attribute, then: Catalog.searchResults({'food', ['foo', 'bar']}) would find all of the objects whose food property contained both 'foo' _and_ 'bar'.
I have browsed through Catalog.py and it seems like it might be possible. Disclaimer, I'm pretty new to Zope & python.
In the general case, it's not possible without redesigning Zope's catalog query language (which implicitly ORs all index queries together). For the special case of keywords, use a keyword index. -Michel
Michel Pelletier <michel@mail2.aracnet.com> wrote:
Catalog.searchResults({'food', ['foo', 'bar']}) ^ I think you meant a : there?
would find all of the objects whose food property contained both 'foo' _and_ 'bar'.
This is not returning the intersection but the union. At least for me. On the other hand, full-text searches appear to handle a phrase like 'foo and bar'. -- Neil Kandalgaonkar <NeilK@ActiveState.com> Web Application Developer, ActiveState
participants (7)
-
Andy McKay -
Andy McKay -
Dieter Maurer -
Michel Pelletier -
Neil K -
Oleg Broytmann -
Shane Hathaway