[Zope3-Users] searching content objects on created datetime
Hi, I am trying to search my content objects on their creation datetime. For example, a user can enter From and To dates and I would like to retrieve all content objects based on the date range. I am thinking I should be using a catalog for this and went about creating an adapter for the content I would like to search providing the following interface: class IContentCreated(Interface): contentCreated = Datetime(title=_(u"Content Created Time")) Then I created a catalog with field index named `created` on IContentCreated interface and contentCreated field. But now I am stuck on how to search the catalog based on a date range. I guess I am trying to do something like my_catalog.searchResults( ??? created > fromDate created < toDate ??? ) Or maybe catalog not the way to go and I should be going straight to the objects. Thanks in advance Alen ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Problem: "Could not locate Zope software installation!"
I downloaded ZopeX3-3.0.1 and Zope3.1 (final). The ./configure | make | make install (as root) went without a hitch. However, when I went to make an instance (with either 3.0.1 or 3.1) I got a "Could not locate Zope software installation!" In both cases, I used the default settings (i.e., Zope was made in /usr/local/Zopex/ I used /usr/local/ZopeX3x/bin/mkzopeinstance -u manager:secret ... and got the error message. I've seen this before in the bug track list, but has anyone got a workaround? I'm using Zope on Gentoo Linux (2.6.13-r2 kernel) with python 2.3.5 and and GCC 3.4.4. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] benji york's quick_start.txt
On Oct 5, 2005, at 1:12 PM, Matthew Russell wrote: Hi, I'm following Benji's quick_start.txt ... TypeError: ('Could not adapt', http://localhost:8080/hello/@@edit.html>, ) Hi Matt. Looks like that might be an omission from the quick start, and a reasonable one at that. We (Zope 3 devs) need to have a default story for adapting request to timezone if formlib is to be part of the trunk (and it is now). Here's a workaround (sorry that it makes you maybe do more than you should have to do for a "quick start"). Make a file, maybe called adapters.py in your package, with this in it: import pytz from zope import interface, component from zope.interface.common.idatetime import ITZInfo from zope.publisher.interfaces.browser import IBrowserRequest @interface.implementer(ITZinfo) @component.adapter(IBrowserRequest) def tzinfo(request): return pytz.timezone('US/Eastern') # or whatever timezone you wish I dunno if Benji is having you use zcml yet. If you are, add this to your zcml: *Otherwise* try adding this to the end of your file-- component.provideAdapter(tzinfo) --and make sure you import the adapters file from someplace so that it will actually run. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] benji york's quick_start.txt
Hi, I'm following Benji's quick_start.txt (http://www.benjiyork.com/quick_start.txt). I've followed everything precisly up to the "Adding Menu Entries" section, at which point zope3 throws the following error: Traceback (most recent call last): File "/home/matt/zope3_quick_start/zope3/src/zope/publisher/publish.py", line 138, in publish result = publication.callObject(request, object) File "/home/matt/zope3_quick_start/zope3/src/zope/app/publication/zopepublication.py", line 164, in callObject return mapply(ob, request.getPositionalArguments(), request) File "/home/matt/zope3_quick_start/zope3/src/zope/publisher/publish.py", line 113, in mapply return debug_call(object, args) File "/home/matt/zope3_quick_start/zope3/src/zope/publisher/publish.py", line 119, in debug_call return object(*args) File "/home/matt/zope3_quick_start/zope3/src/zope/formlib/form.py", line 739, in __call__ self.update() File "/home/matt/zope3_quick_start/zope3/src/zope/formlib/form.py", line 720, in update result = action.success(data) File "/home/matt/zope3_quick_start/zope3/src/zope/formlib/form.py", line 568, in success return self.success_handler(self.form, self, data) File "/home/matt/zope3_quick_start/zope3/src/zope/formlib/form.py", line 780, in handle_edit_action mapping={'date_time': File "/home/matt/zope3_quick_start/zope3/src/zope/interface/interface.py", line 704, in __call__ raise TypeError("Could not adapt", obj, self) TypeError: ('Could not adapt', http://localhost:8080/hello/@@edit.html>, ) I assume this is because I'm using a checkout from the trunk, and something's borked? If not, then I assume there is an omission in the quick_start.txt, and the view class needs to implement IBrowerRequest (or something like that... not sure!) Environment: Ubuntu Linux (Breezy) Python 2.4.2 Zope3 (svn checkout as persibed by quick_start.txt) Anyone have the same error or know where I'm going wrong? I've made sure to check and re-check the code to ensure it matches that in the quick_start.txt. cheers, Matt -- Cheers, matt ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: event subscribers
Florent, thanks for the thoughts... :) I'm using zope.app.workflow (the X3.0 addon). IRelease is just a content object. I think, just like you mentioned, that I can work my way around it by looking at event.object... Just like you mentioned, and Jim mentioned earlier, I think I was counting on a behavior that mirrored IObjectEvent (like someMethod(obj, event) to be the subscribing method). if I get it working using event.object instead of method(object, event), I might look at hacking out a change, at least to see how far i can get with it, to zope.app.workflow to redispatch, but I don't think I understand the event dispatch machinery well enough yet to know if it's within my grasp. a review of IObjectEvent is in order for me ;) Thanks much! PeteOn 10/5/05, Florent Guillaume <[EMAIL PROTECTED]> wrote: Pete Taylor wrote:> hi all... question for any event subscriber gurus (or just anyone who knows> more than me, which probably won't take much ;) )>> i have a set of actions that i would like to have trigger off of a > particular state in a workflow. in my unittest i can see that the workflow> fires the event, but my subscriber doesn't pick up on it. similarly, the> subscriber i have in zcml in the application proper does not respond when > the workflow transition event is fired.>> the functionality works if i explicitly call my subscription method against> the event, but that only proves that the functionality of the code isn't > broken...>> the relevant zcml portion is as follows:> > for="">> zope.app.workflow.stateful.interfaces.IAfterTransitionEvent" > factory=".release.notifyTransition"> />>> the unittest subscribes with ztapi as follows:> ztapi.subscribe((IRelease, IAfterTransitionEvent), None, notifyTransition)As Jim mentioned, and as I discovered yesterday :), the ability to subscribe using a multi-adapter is not "stock" behavior of the basic eventnotification (which only sends one IEvent object), but actually behavior ofthe IObjectEvents, which have a special subscriber re-dispatching on both event.object and event, so that the multi-adapter subscribers can work.What workflow framework are you using ? And what'sqarelease.interfaces.IRelease ? Is it a transition or something else ?That framework could be updated to do the same dance, if there's a clear "object" there. Or maybe some workflow event interfaces could be subclassedfrom IObjectEvent.Florent--Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D+33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED] ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: event subscribers
Pete Taylor wrote: hi all... question for any event subscriber gurus (or just anyone who knows more than me, which probably won't take much ;) ) i have a set of actions that i would like to have trigger off of a particular state in a workflow. in my unittest i can see that the workflow fires the event, but my subscriber doesn't pick up on it. similarly, the subscriber i have in zcml in the application proper does not respond when the workflow transition event is fired. the functionality works if i explicitly call my subscription method against the event, but that only proves that the functionality of the code isn't broken... the relevant zcml portion is as follows: the unittest subscribes with ztapi as follows: ztapi.subscribe((IRelease, IAfterTransitionEvent), None, notifyTransition) As Jim mentioned, and as I discovered yesterday :), the ability to subscribe using a multi-adapter is not "stock" behavior of the basic event notification (which only sends one IEvent object), but actually behavior of the IObjectEvents, which have a special subscriber re-dispatching on both event.object and event, so that the multi-adapter subscribers can work. What workflow framework are you using ? And what's qarelease.interfaces.IRelease ? Is it a transition or something else ? That framework could be updated to do the same dance, if there's a clear "object" there. Or maybe some workflow event interfaces could be subclassed from IObjectEvent. Florent -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D +33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED] ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] object has no attribute '_SampleContainer__data'
Tom Dossis wrote: Jim Fulton wrote: Tom Dossis wrote: Leticia Larrosa wrote: I get the following error: """ 'Service' object has no attribute '_SampleContainer__data' """ I implementend a simple subclass of SampleContainer, then changed to subclass BTreeContainer, but forget to delete existing instances created in Zope. A tell tale sign is you can no longer delete the broken instance(s) This sounds like a bug. Could you report this with a specific example? Jim I can remember exactly how I naively did this originally, but I can achieve it with a little sabotage.. I missinterpreted your original message. I thought you were dealing with Broken objects, not broken objects. :) Broken objects are objects that can't be created, usually becase their class isn't around any more. The system should be able to recognize these and at least allow their deletion. >>> class Bogus(BTreeContainer): pass ... >>> bogus = Bogus() >>> root['bogus'] = bogus = Bogus() >>> del bogus.__dict__['_SampleContainer__data'] >>> del root['f'] Traceback (most recent call last): : File ".. /zope/interface/adapter.py", line 487, in subscribers subscribers = [subscription(*objects) File ".. /zope/app/container/contained.py", line 177, in dispatchToSublocations for sub in subs.sublocations(): File ".. /zope/app/container/contained.py", line 208, in sublocations for key in container: File ".. /zope/app/container/sample.py", line 56, in __iter__ return iter(self.__data) AttributeError: 'Bogus' object has no attribute '_SampleContainer__data' Is this a bug because the container now fails to fulfill it's interface causing object propogation to fail? Yes. Is defensive programming desirable or appropriate? Possibly. Probably only in the delete-object case. Ideally, if there was an error when deleting an object, the error would be reported and some UI might be provided to force delete even in the face of errors -- perhaps only if the user has a stronger permission. subs = ISublocations(object, None) if subs is not None: for sub in subs.sublocations(): def sublocations(self) container = self.container for key in container: yield container[key] I don't know what your point is here. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] bug on HP-UX 11.00
I don't know much about HPUX, but one issue that seems to plague a lot of less-frequently-used platforms is stack sizes. For example, for a while in FreeBSD and on MacOS, you needed to explicitly bump up the thread stack size. See doc/PLATFORMS/BSD.txt in the Zope release for an idea about how to do this. - C On Oct 5, 2005, at 10:08 AM, Chris Leonello wrote: I have been successfully running for many months on Windows XP and Mac OS X. I cannot get the server to run on HP-UX, however. I can build and install o.k., but when I visit http://127.0.0.1:8080/ in the browser, the process either hangs (built under python 2.3.5) or terminates with a bus error (built under python 2.4.1 or 2.4.2). In any case, the (verbose) output from the runzope process looks like this: -- 2005-10-03T17:34:31 WARNING ZODB.FileStorage Ignoring index for /ford/et17112/u/cleonell/cusr/local/zopehome/var/Data.fs -- 2005-10-03T17:34:31 INFO PublisherHTTPServer zope.server.http (HTTP) started. Hostname: et17112 Port: 8080 -- 2005-10-03T17:34:31 INFO PublisherFTPServer zope.server.ftp started. Hostname: et17112 Port: 8021 -- 2005-10-03T17:34:31 INFO root Startup time: 20.685 sec real, 12.460 sec CPU # /ford/et17112/u/cleonell/cusr/local/Zope-3.1.0/lib/python/zope/i18n/ locales/xmlfactory.pyc matches /ford/et17112/u/cleonell/cusr/local/Zope-3.1.0/lib/python/zope/i18n/ locales/xmlfactory.py import zope.i18n.locales.xmlfactory # precompiled from /ford/et17112/u/cleonell/cusr/local/Zope-3.1.0/lib/python/zope/i18n/ locales/xmlfactory.pyc # /ford/et17112/u/cleonell/cusr/local/lib/python2.3/xml/dom/ expatbuilder.pyc matches /ford/et17112/u/cleonell/cusr/local/lib/python2.3/xml/dom/ expatbuilder.py import xml.dom.expatbuilder # precompiled from /ford/et17112/u/cleonell/cusr/local/lib/python2.3/xml/dom/ expatbuilder.pyc Terminated (If I killed process or Bus Error under python 2.4.1/.2) I don't know if the initial warning is significant or not. I don't know if this is related or not, but the test suite (compiled under python 2.3.5) hangs on testLargeBody: 6692/6990 ( 95.7%): testChunkingRequestWithoutContent (zope.server.http.tests.test_httpserver.Tests) ... ok 6693/6990 ( 95.8%): testEchoResponse (zope.server.http.tests.test_httpserver.Tests) ... ok 6694/6990 ( 95.8%): testLargeBody (zope.server.http.tests.test_httpserver.Tests) ... It gets caught in an infinite loop in the "loop" method (I killed it after 55,000 iterations). Any help or feedback is appreciated. Thanks! Chris Leonello [EMAIL PROTECTED] __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] bug on HP-UX 11.00
I have been successfully running for many months on Windows XP and Mac OS X. I cannot get the server to run on HP-UX, however. I can build and install o.k., but when I visit http://127.0.0.1:8080/ in the browser, the process either hangs (built under python 2.3.5) or terminates with a bus error (built under python 2.4.1 or 2.4.2). In any case, the (verbose) output from the runzope process looks like this: -- 2005-10-03T17:34:31 WARNING ZODB.FileStorage Ignoring index for /ford/et17112/u/cleonell/cusr/local/zopehome/var/Data.fs -- 2005-10-03T17:34:31 INFO PublisherHTTPServer zope.server.http (HTTP) started. Hostname: et17112 Port: 8080 -- 2005-10-03T17:34:31 INFO PublisherFTPServer zope.server.ftp started. Hostname: et17112 Port: 8021 -- 2005-10-03T17:34:31 INFO root Startup time: 20.685 sec real, 12.460 sec CPU # /ford/et17112/u/cleonell/cusr/local/Zope-3.1.0/lib/python/zope/i18n/locales/xmlfactory.pyc matches /ford/et17112/u/cleonell/cusr/local/Zope-3.1.0/lib/python/zope/i18n/locales/xmlfactory.py import zope.i18n.locales.xmlfactory # precompiled from /ford/et17112/u/cleonell/cusr/local/Zope-3.1.0/lib/python/zope/i18n/locales/xmlfactory.pyc # /ford/et17112/u/cleonell/cusr/local/lib/python2.3/xml/dom/expatbuilder.pyc matches /ford/et17112/u/cleonell/cusr/local/lib/python2.3/xml/dom/expatbuilder.py import xml.dom.expatbuilder # precompiled from /ford/et17112/u/cleonell/cusr/local/lib/python2.3/xml/dom/expatbuilder.pyc Terminated (If I killed process or Bus Error under python 2.4.1/.2) I don't know if the initial warning is significant or not. I don't know if this is related or not, but the test suite (compiled under python 2.3.5) hangs on testLargeBody: 6692/6990 ( 95.7%): testChunkingRequestWithoutContent (zope.server.http.tests.test_httpserver.Tests) ... ok 6693/6990 ( 95.8%): testEchoResponse (zope.server.http.tests.test_httpserver.Tests) ... ok 6694/6990 ( 95.8%): testLargeBody (zope.server.http.tests.test_httpserver.Tests) ... It gets caught in an infinite loop in the "loop" method (I killed it after 55,000 iterations). Any help or feedback is appreciated. Thanks! Chris Leonello [EMAIL PROTECTED] __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Re: event subscribers
>Normallym event subscribers are single-object adapters. In some cases, >we have subscrobers that redispatch on multiple objects. For example, >object events have a subscriber that redispatches events based on the >object and event. You expect something similar to be going on for workflow >events, but I suspect there isn't. >Jim Thanks for the response... I think in large part I just don't understand the event dispatch machinery well enough. I looked through most of the workflow code and am able to see where fireTransition occurs, notifying both the before and after transition events. redispatching though is beyond me. I'll read up. thanks! Pete ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] object has no attribute '_SampleContainer__data'
Jim Fulton wrote: Tom Dossis wrote: Leticia Larrosa wrote: I get the following error: """ 'Service' object has no attribute '_SampleContainer__data' """ I implementend a simple subclass of SampleContainer, then changed to subclass BTreeContainer, but forget to delete existing instances created in Zope. A tell tale sign is you can no longer delete the broken instance(s) This sounds like a bug. Could you report this with a specific example? Jim I can remember exactly how I naively did this originally, but I can achieve it with a little sabotage.. >>> class Bogus(BTreeContainer): pass ... >>> bogus = Bogus() >>> root['bogus'] = bogus = Bogus() >>> del bogus.__dict__['_SampleContainer__data'] >>> del root['f'] Traceback (most recent call last): : File ".. /zope/interface/adapter.py", line 487, in subscribers subscribers = [subscription(*objects) File ".. /zope/app/container/contained.py", line 177, in dispatchToSublocations for sub in subs.sublocations(): File ".. /zope/app/container/contained.py", line 208, in sublocations for key in container: File ".. /zope/app/container/sample.py", line 56, in __iter__ return iter(self.__data) AttributeError: 'Bogus' object has no attribute '_SampleContainer__data' Is this a bug because the container now fails to fulfill it's interface causing object propogation to fail? Is defensive programming desirable or appropriate? subs = ISublocations(object, None) if subs is not None: for sub in subs.sublocations(): def sublocations(self) container = self.container for key in container: yield container[key] -Tom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Object Name field on addforms
Am Sonntag, 11. September 2005 20:25 schrieb Stephan Richter: > On Sunday 11 September 2005 10:07, Florian Lindner wrote: > > The field is displayed when the addform is called with > > folder/+/AddCSLink.html. > > In this case AddCSLink.html is a view for IAdding. > > > When folder/AddCSLink.html is is not displayed. > > Here AddCSLink.html is a view of IContainer. > > > What is the difference between these two? > > I am surprised both would work. Only the first one should. > > > Unfortunatly when you use the addform directive to register a menu item > > the action is folder/AddCSLink.html. Can this be changed? > > Don't use the menu/title attributes of form:addform. Use the > browser:addMenuItem directive instead. I've managed to register it now with a serperate addMenuItem directive. But the URL of the menu item is still folder/AddCSLink.html and not folder/+/AddCSLink.html and it's still the same error like I was registering it within the addform directive. Thanks, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] event subscribers
Pete Taylor wrote: hi all... question for any event subscriber gurus (or just anyone who knows more than me, which probably won't take much ;) ) i have a set of actions that i would like to have trigger off of a particular state in a workflow. in my unittest i can see that the workflow fires the event, but my subscriber doesn't pick up on it. similarly, the subscriber i have in zcml in the application proper does not respond when the workflow transition event is fired. the functionality works if i explicitly call my subscription method against the event, but that only proves that the functionality of the code isn't broken... the relevant zcml portion is as follows: for="qarelease.interfaces.IRelease zope.app.workflow.stateful.interfaces.IAfterTransitionEvent" factory=".release.notifyTransition" /> the unittest subscribes with ztapi as follows: ztapi.subscribe((IRelease, IAfterTransitionEvent), None, notifyTransition) this seems, from both srichter's book and philiKON's book to be the right way to do this (moving from ztapi.handle to ztapi.subscribe since handle is being deprecated). does anyone have any experience in attempting to do anything like this? Normallym event subscribers are single-object adapters. In some cases, we have subscrobers that redispatch on multiple objects. For example, object events have a subscriber that redispatches events based on the object and event. You expect something similar to be going on for workflow events, but I suspect there isn't. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users