Re: ZCatalog & resource not found error
No, I'm afraid that's not it...the code below gives an attribute error, and I have other scripts where I call getObject on a brain object and have no problems...I think this and a few other methods on the brain objects were added in Zope 2.3. Even this fails: results = container.Catalog(meta_type='Broadcast', getStartTime=DateTime(), getStartTime_usage='range:min', sort_on='getStartTime') result = results[0] return result And the strange thing is that it's failing on the last line (i.e., the return statement). If I change that line to return a dummy string then there's no problem. I could swear that I had something analogous to this working before...is there a bug? I tried upgrading to 2.3.2, but that hasn't helped. :-( Chris McDonough <chrism@digicool.com> writes:
The objects returned in the sequence returned from Catalog.searchResults are "brain" objects. These objects have no default representation. This may be what you're looking to do:
results = container.Catalog(meta_type='Broadcast', getStartTime=DateTime(), getStartTime_usage='range:min', sort_on='getStartTime')
result = results[0] return container.Catalog.getObject(result)
Tim Moore wrote:
This python script:
>
return results[0]
produces this error when I click the 'Test' tab:
Zope has encountered an error while publishing this resource.
Resource not found
Sorry, the requested Zope resource does not exist. Check the URL and try again.
If I take the [0] part off and have it return the whole results list, I have no problems (it returns a list with two items). Weird.
Any clues? (Zope 2.3.1 (binary release, python 1.5.2, win32-x86)) -- Tim Moore
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Tim Moore
You say it gives an attribute error... what is the attribute error? In any case, neither method definition you've provided will be very useful if exercised from the Test tab. Is that still how you're doing it? Or are you calling it from a DTML method? What is the whole calling sequence and how is the object that gets returned from this script used? ----- Original Message ----- From: "Tim Moore" <tmoore@tembel.org> To: <zope@zope.org> Sent: Thursday, May 10, 2001 1:24 PM Subject: [Zope] Re: ZCatalog & resource not found error
No, I'm afraid that's not it...the code below gives an attribute error, and I have other scripts where I call getObject on a brain object and have no problems...I think this and a few other methods on the brain objects were added in Zope 2.3.
Even this fails:
results = container.Catalog(meta_type='Broadcast', getStartTime=DateTime(), getStartTime_usage='range:min', sort_on='getStartTime') result = results[0] return result
And the strange thing is that it's failing on the last line (i.e., the return statement). If I change that line to return a dummy string then there's no problem.
I could swear that I had something analogous to this working before...is there a bug? I tried upgrading to 2.3.2, but that hasn't helped. :-(
Chris McDonough <chrism@digicool.com> writes:
The objects returned in the sequence returned from Catalog.searchResults are "brain" objects. These objects have no default representation. This may be what you're looking to do:
results = container.Catalog(meta_type='Broadcast', getStartTime=DateTime(), getStartTime_usage='range:min', sort_on='getStartTime')
result = results[0] return container.Catalog.getObject(result)
Tim Moore wrote:
This python script:
>
return results[0]
produces this error when I click the 'Test' tab:
Zope has encountered an error while publishing this resource.
Resource not found
Sorry, the requested Zope resource does not exist. Check the URL and try again.
If I take the [0] part off and have it return the whole results list, I have no problems (it returns a list with two items). Weird.
Any clues? (Zope 2.3.1 (binary release, python 1.5.2, win32-x86)) -- Tim Moore
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Tim Moore
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Chris McDonough -
Tim Moore