Re: [Zope3-Users] Re: EditForm fails in SiteManager because of containment constraint
Jürgen Kartnaller a écrit : Christophe Combelles wrote: Hello, I have a regular content object which uses the formlib for its edit view. Nothing special, just like a Recipe. But I want this object to only reside in the Site Manager, because it will be used as a configurable local utility (some kind of LocalKitchenTools utility) Everything is perfect, and the EditForm works well until I want to tell this object to be only contained in the SiteManager. So I just add this statement in the interface: containers(ILocalSiteManager) or containers(ISiteManagementFolder) 'container' adds __parent__ as schema.Field attribute to your interface. You need to omit __parent__ in your formlib form_fields definition. thanks, that's it, so I will omit only __parent__ You had already answered while I was still writing my previous post :) Couldn't this thing be managed by the formlib itself? The error is not explicit and does not mention __parent__ anywhere Christophe Jürgen ___ 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
Re: [Zope3-Users] EditForm fails in SiteManager because of containment constraint
OK, I've finally found, Actually, it was failing also in the content side My object is not IContained. And since I'm adding containment constraints, I guess my object was considered Contained (containment proxy?). So the EditForm was expecting __name__ and __parent__ and was failing somewhere. I've just added omit('__name__', '__parent__') in the form and it works. But I can't explain why I have to add this omit() when my object is not contained. Is it silly to add a containment constraint on a not Contained object? Shouldn't the containment proxy manage this by itself? Christophe Christophe Combelles a écrit : Hello, I have a regular content object which uses the formlib for its edit view. Nothing special, just like a Recipe. But I want this object to only reside in the Site Manager, because it will be used as a configurable local utility (some kind of LocalKitchenTools utility) Everything is perfect, and the EditForm works well until I want to tell this object to be only contained in the SiteManager. So I just add this statement in the interface: containers(ILocalSiteManager) or containers(ISiteManagementFolder) When I do any of these, the EditForm fails with a ComponentLookupError What Am I missing? Why does a simple constraint create an error on this? Christophe Error object: ((0xb58a9bec>, URL=http://localhost:9673/++lang++en/++skin++Debug/testsite/++etc++site/default/ppp/@@edit.html>), , u'') File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 133, in publish result = publication.callObject(request, obj) File "/usr/lib/python2.4/site-packages/zope/app/publication/zopepublication.py", line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 108, in mapply return debug_call(obj, args) File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 114, in debug_call return obj(*args) File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 769, in __call__ self.update() File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 732, in update self.setUpWidgets() File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 802, in setUpWidgets adapters=self.adapters, ignore_request=ignore_request File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 393, in setUpEditWidgets widget = _createWidget(form_field, field, request, iface) File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 323, in _createWidget return component.getMultiAdapter((field, request), iface) File "/usr/lib/python2.4/site-packages/zope/component/_api.py", line 103, in getMultiAdapter raise ComponentLookupError(objects, interface, name) ___ 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] Re: EditForm fails in SiteManager because of containment constraint
Christophe Combelles wrote: Hello, I have a regular content object which uses the formlib for its edit view. Nothing special, just like a Recipe. But I want this object to only reside in the Site Manager, because it will be used as a configurable local utility (some kind of LocalKitchenTools utility) Everything is perfect, and the EditForm works well until I want to tell this object to be only contained in the SiteManager. So I just add this statement in the interface: containers(ILocalSiteManager) or containers(ISiteManagementFolder) 'container' adds __parent__ as schema.Field attribute to your interface. You need to omit __parent__ in your formlib form_fields definition. Jürgen ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] EditForm fails in SiteManager because of containment constraint
Hello, I have a regular content object which uses the formlib for its edit view. Nothing special, just like a Recipe. But I want this object to only reside in the Site Manager, because it will be used as a configurable local utility (some kind of LocalKitchenTools utility) Everything is perfect, and the EditForm works well until I want to tell this object to be only contained in the SiteManager. So I just add this statement in the interface: containers(ILocalSiteManager) or containers(ISiteManagementFolder) When I do any of these, the EditForm fails with a ComponentLookupError What Am I missing? Why does a simple constraint create an error on this? Christophe Error object: ((, URL=http://localhost:9673/++lang++en/++skin++Debug/testsite/++etc++site/default/ppp/@@edit.html>), , u'') File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 133, in publish result = publication.callObject(request, obj) File "/usr/lib/python2.4/site-packages/zope/app/publication/zopepublication.py", line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 108, in mapply return debug_call(obj, args) File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 114, in debug_call return obj(*args) File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 769, in __call__ self.update() File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 732, in update self.setUpWidgets() File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 802, in setUpWidgets adapters=self.adapters, ignore_request=ignore_request File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 393, in setUpEditWidgets widget = _createWidget(form_field, field, request, iface) File "/usr/lib/python2.4/site-packages/zope/formlib/form.py", line 323, in _createWidget return component.getMultiAdapter((field, request), iface) File "/usr/lib/python2.4/site-packages/zope/component/_api.py", line 103, in getMultiAdapter raise ComponentLookupError(objects, interface, name) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: execution time of a request?
Hi Cristophe. Found it and it looks helpful for sure. Many thanks. Regards, David Christophe Combelles wrote: You can find interesting things on his blog: http://mg.pov.lt/blog/benchmarking-zope3-apps.html Christophe David Pratt a écrit : Hi Jurgen and Marius. Can you advise whether the profiling library is generally available and if so where to find it. Many thanks. Regards, David Jürgen Kartnaller wrote: By the way, marius, thanks for your great profiling library. ___ 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 mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: execution time of a request?
You can find interesting things on his blog: http://mg.pov.lt/blog/benchmarking-zope3-apps.html Christophe David Pratt a écrit : Hi Jurgen and Marius. Can you advise whether the profiling library is generally available and if so where to find it. Many thanks. Regards, David Jürgen Kartnaller wrote: By the way, marius, thanks for your great profiling library. ___ 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
Re: [Zope3-Users] Re: execution time of a request?
Hi Jurgen and Marius. Can you advise whether the profiling library is generally available and if so where to find it. Many thanks. Regards, David Jürgen Kartnaller wrote: By the way, marius, thanks for your great profiling library. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] still filter in addmenuitem
sorry for attaching files, but in this way may be it will be more clear. on the Type object.gif you can see that Article can be added to Type objects. on the Article object.gif you can see that nothing can be added to an Article object (manually). that's why i use the filter, but the Add menu point is still visible (rounded with read drawing). and if you click on it you can see on the article add.gif the screen. to complete the whole story Article can contain other Article objects, only the manual adding needs to be disabled. On 4/4/07, Christophe Combelles <[EMAIL PROTECTED]> wrote: I don't really understand, do you want to hide the full Add menu, or just the menu entry for your content object? Remember you can also filter the menu entry by interface and not only with the filter. (btw I've never used this filter yet) Christophe Ivan Horvath a écrit : > Dear All, > > as i wrote in one of my previous e-mail i use filter property in > addMenuItem directive. > filter = context/context/isNeedtoDisplay | nothing > > the add menu (below the navigation tree) is not displaying for the > certain object, but there is an Add menu in zmi_actions menu bar. > when i click on it it displays an empty textbox to create an object. > how can i disappear it? or is it a bug? > > Ivan > ___ > 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 Type object.gif Description: GIF image Article object.gif Description: GIF image article add.gif Description: GIF image ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: execution time of a request?
By the way, marius, thanks for your great profiling library. We used it this week to track down our performance issues and could increase the speed of some of our functions by a factor of 10 or more(!) The zope index checkin's this week result from using your profile decorator. Especially the change in z3c.tag could easily be tracked down by simply adding @profile to our code. Jürgen Marius Gedminas wrote: On Fri, Apr 06, 2007 at 11:15:47PM +0200, Maciej Wisniowski wrote: does anyone know a method to get or compute the execution time of a request? Lori - plugin for firefox, or firebug etc? Or do you want to display this on page? Firebug doesn't quite cut it: it only displays time spent downloading, not the time spent waiting until Zope processes the request. I usually wrap my view's __call__ in a @timecall decorator like this: def timecall(fn): def new_fn(*args, **kw): try: start = time.time() return fn(*args, **kw) finally: duration = time.time() - start funcname = fn.__name__ filename = fn.func_code.co_filename lineno = fn.func_code.co_firstlineno print >> sys.stderr, "\n %s (%s:%s):\n%.3f seconds\n" % ( funcname, filename, lineno, duration) new_fn.__doc__ = fn.__doc__ return new_fn Marius Gedminas ___ 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
Re: [Zope3-Users] execution time of a request?
On Fri, Apr 06, 2007 at 11:15:47PM +0200, Maciej Wisniowski wrote: > > does anyone know a method to get or compute the execution time of a > > request? > Lori - plugin for firefox, or firebug etc? > Or do you want to display this on page? Firebug doesn't quite cut it: it only displays time spent downloading, not the time spent waiting until Zope processes the request. I usually wrap my view's __call__ in a @timecall decorator like this: def timecall(fn): def new_fn(*args, **kw): try: start = time.time() return fn(*args, **kw) finally: duration = time.time() - start funcname = fn.__name__ filename = fn.func_code.co_filename lineno = fn.func_code.co_firstlineno print >> sys.stderr, "\n %s (%s:%s):\n%.3f seconds\n" % ( funcname, filename, lineno, duration) new_fn.__doc__ = fn.__doc__ return new_fn Marius Gedminas -- Veni, Vidi, VISA: I came, I saw, I did a little shopping. signature.asc Description: Digital signature ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users