I am having a bit of a problem making CatalogQuery 0.1.1 behave how I want it to under Zope 2.4.0. Basically, I have a Script (Python) that accepts a parameter 'search', that I want to use inside the 'query' method of Catalog. Here is my code: results = context.Catalog.query('title==search', REQUEST) # or paint==search or exhibition==search or style==search or for_sale==search)
From this, I get:
Error Type: NameError Error Value: name 'search' is not defined Removing the quotes, thus: results = context.Catalog.query(title==search, REQUEST) # or paint==search or exhibition==search or style==search or for_sale==search) I get, this error: Error Type: AttributeError Error Value: 'int' object has no attribute 'replace' I'm sure it's me being dumb (but I have tried searching the list archive), coz that has certainly been the case in the past, but if anyone could point me in the right direction, I'd be mightily appreciative. cheers tim
On Fri, Sep 07, 2001 at 01:31:41AM +0100, Tim Hicks wrote:
results = context.Catalog.query('title==search', REQUEST) # or paint==search or exhibition==search or style==search or for_sale==search)
From this, I get:
Error Type: NameError Error Value: name 'search' is not defined
The problem, I tink in the syntax 'title==search'. Here "title" is the name of argument (passed to Python function), but you declare that "search" is a name of a variable. You have no such variable, hence NameError. Try 'title=="search"' (thta is, pass "search" as a string, not var). Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (2)
-
Oleg Broytmann -
Tim Hicks