From me at rpatterson.net Tue Jan 2 04:47:01 2007 From: me at rpatterson.net (Ross Patterson) Date: Mon, 01 Jan 2007 19:47:01 -0800 Subject: [z3-five] Using vocabularies for Choice fields where the vocabulary is acquired References: <4592CE19.7000202@hannosch.info> Message-ID: <87bqlit7ii.fsf@superfluity.lefae.org> Martin Aspeli writes: > Hanno Schlichting wrote: > >> I'm not sure that my approach is by any means good or advisable but you >> could take a look at the PortalTypesVocabulary in >> plone.app.controlpanel.vocabularies and its usage on the search control >> panel defined by the ISearchSchema in search.py in the same package. >> >> The code can be found at >> http://dev.plone.org/plone/browser/plone.app.controlpanel/trunk/plone/app/controlpanel >> >>> Can anyone point me to some code or documentation that shows how to wait >>> until run-time to define the vocabulary, and gives me the current >>> context from which to do so? >> >> Maybe you can even just use the vocabulary I've already written in which >> case we might need to move it to a more general package. > > Ah, excellent Hanno. :) > > I can use this just by name, I guess. Having a package > (plone.app.vocabularies?) with common vocabularies (portal type, > workflow states, roles, groups, users...) may make sense. > > I'm adding roles and groups to plone.app.contentrules.vocabularies, if > you're up for the task of consolidating (I don't have time right now). > > Martin Ive been getting up to speed on Z3 schemas and I was wondering why plone.app.vocabularies uses vocabularies instead of sources? Ross From plone at hannosch.info Tue Jan 2 07:43:41 2007 From: plone at hannosch.info (Hanno Schlichting) Date: Tue, 02 Jan 2007 07:43:41 +0100 Subject: [z3-five] Using vocabularies for Choice fields where the vocabulary is acquired In-Reply-To: <87bqlit7ii.fsf@superfluity.lefae.org> References: <4592CE19.7000202@hannosch.info> <87bqlit7ii.fsf@superfluity.lefae.org> Message-ID: <4599FF1D.6010800@hannosch.info> Hi Ross, Ross Patterson wrote: >> Hanno Schlichting wrote: >> >>> I'm not sure that my approach is by any means good or advisable but you >>> could take a look at the PortalTypesVocabulary in >>> plone.app.controlpanel.vocabularies and its usage on the search control >>> panel defined by the ISearchSchema in search.py in the same package. > > Ive been getting up to speed on Z3 schemas and I was wondering why > plone.app.vocabularies uses vocabularies instead of sources? As my first sentence should have told you, I'm by no means an expert or even an advanced user of formlib. So vocabularies were just what I found working for me quite easily. I know there have been some talk on the Zope3 mailing list a while back that vocabularies are going to be deprecated in favor of sources someday, but it also sounded like sources are not yet as well documented and easy to use. If you could enlighten us how to use sources instead for one of the vocabularies currently in plone.app.vocabularies that would be awesome. Thx, Hanno From me at rpatterson.net Tue Jan 2 10:15:41 2007 From: me at rpatterson.net (Ross Patterson) Date: Tue, 02 Jan 2007 01:15:41 -0800 Subject: [z3-five] Using vocabularies for Choice fields where the vocabulary is acquired References: <4592CE19.7000202@hannosch.info> <87bqlit7ii.fsf@superfluity.lefae.org> <4599FF1D.6010800@hannosch.info> Message-ID: <87zm91ssaq.fsf@superfluity.lefae.org> Hanno Schlichting writes: > Hi Ross, > > Ross Patterson wrote: >>> Hanno Schlichting wrote: >>> >>>> I'm not sure that my approach is by any means good or advisable but you >>>> could take a look at the PortalTypesVocabulary in >>>> plone.app.controlpanel.vocabularies and its usage on the search control >>>> panel defined by the ISearchSchema in search.py in the same package. >> >> Ive been getting up to speed on Z3 schemas and I was wondering why >> plone.app.vocabularies uses vocabularies instead of sources? > > As my first sentence should have told you, I'm by no means an expert or > even an advanced user of formlib. So vocabularies were just what I found > working for me quite easily. > > I know there have been some talk on the Zope3 mailing list a while back > that vocabularies are going to be deprecated in favor of sources > someday, but it also sounded like sources are not yet as well documented > and easy to use. > > If you could enlighten us how to use sources instead for one of the > vocabularies currently in plone.app.vocabularies that would be awesome. > > Thx, > Hanno Ok, as I educate myself I'll try and submit some patches back. Thanks! Ross From y.2007- at wcm-solutions.de Sun Jan 7 14:48:43 2007 From: y.2007- at wcm-solutions.de (yuppie) Date: Sun, 07 Jan 2007 14:48:43 +0100 Subject: [z3-five] Zope 2.10.2 coming up In-Reply-To: References: Message-ID: <45A0FA3B.5070901@wcm-solutions.de> Hi! Andreas Jung wrote: > I plan to release Zope 2.10.2 in a week or so (don't nail > me to a particular date). The Zope 2.10 branch still uses Five 1.5.1. There are a few changes on the Five 1.5 branch (including a security fix) which should become part of Zope 2.10.2. I volunteer to resolve this as follows: Five releases are now linked tightly to specific Zope releases, so it doesn't make much sense to do still separate Five releases. See this thread: http://codespeak.net/pipermail/z3-five/2006q4/001889.html If there are no objections, I'll stitch the Five 1.5 branch HEAD directly into the Zope 2.10 branch (without using svn externals) and Five trunk HEAD into the Zope trunk. This would mean that from now on Five 1.5 and 1.6 are maintained as part of Zope 2. In fact there will be no Five 1.5.2 or 1.6 because there will no longer be any separate releases. Thoughts? Cheers, Yuppie From lists at zopyx.com Sun Jan 7 15:28:59 2007 From: lists at zopyx.com (Andreas Jung) Date: Sun, 07 Jan 2007 15:28:59 +0100 Subject: [z3-five] Zope 2.10.2 coming up In-Reply-To: <45A0FA3B.5070901@wcm-solutions.de> References: <45A0FA3B.5070901@wcm-solutions.de> Message-ID: <5F17C43487CFA815EF07CEEC@suxmac2.local> --On 7. Januar 2007 14:48:43 +0100 yuppie wrote: > If there are no objections, I'll stitch the Five 1.5 branch HEAD directly > into the Zope 2.10 branch (without using svn externals) and Five trunk > HEAD into the Zope trunk. This would mean that from now on Five 1.5 and > 1.6 are maintained as part of Zope 2. In fact there will be no Five 1.5.2 > or 1.6 because there will no longer be any separate releases. I don't have a problem with this approach. In fact the change would make clear which version belongs to what. Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20070107/7aba69f4/attachment.pgp From georgeleejr at gmail.com Sun Jan 7 20:57:56 2007 From: georgeleejr at gmail.com (George Lee) Date: Sun, 7 Jan 2007 19:57:56 +0000 (UTC) Subject: [z3-five] Customizing ZopeTwoPageTemplates through the web Message-ID: Hi, What is the progress on work being done to make Zope3's ZopeTwoPageTemplates customizable through the web? I remember seeing a post or changeset about work being done on this but can't find it now. The beauty of calling templates as methods on a view, i.e. and then defining a subthread.pt, is wonderful but I'm wondering when it'll be able to customize these templates TTW. Peace, George From philipp at weitershausen.de Mon Jan 8 09:58:08 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Mon, 08 Jan 2007 09:58:08 +0100 Subject: [z3-five] Zope 2.10.2 coming up In-Reply-To: <45A0FA3B.5070901@wcm-solutions.de> References: <45A0FA3B.5070901@wcm-solutions.de> Message-ID: <45A207A0.8080903@weitershausen.de> yuppie wrote: > Hi! > > > Andreas Jung wrote: >> I plan to release Zope 2.10.2 in a week or so (don't nail >> me to a particular date). > > The Zope 2.10 branch still uses Five 1.5.1. There are a few changes on > the Five 1.5 branch (including a security fix) which should become part > of Zope 2.10.2. > > I volunteer to resolve this as follows: > > Five releases are now linked tightly to specific Zope releases, so it > doesn't make much sense to do still separate Five releases. See this > thread: > http://codespeak.net/pipermail/z3-five/2006q4/001889.html > > If there are no objections, I'll stitch the Five 1.5 branch HEAD > directly into the Zope 2.10 branch (without using svn externals) and > Five trunk HEAD into the Zope trunk. This would mean that from now on > Five 1.5 and 1.6 are maintained as part of Zope 2. In fact there will be > no Five 1.5.2 or 1.6 because there will no longer be any separate releases. > > Thoughts? + sys.maxint -- http://worldcookery.com -- Professional Zope documentation and training 2nd edition of Web Component Development with Zope 3 is now shipping! From philipp at weitershausen.de Tue Jan 9 00:12:18 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 09 Jan 2007 00:12:18 +0100 Subject: [z3-five] MailHosts as utilities In-Reply-To: <86D9AF3A9BF3B999CD88A467@suxmac2.local> References: <4577E35D.6030805@simplistix.co.uk> <319e029f0612070320y5e6e84c0ye466d68acfb0b5d0@mail.gmail.com> <86D9AF3A9BF3B999CD88A467@suxmac2.local> Message-ID: <45A2CFD2.4050309@weitershausen.de> Andreas Jung wrote: >> On 12/7/06, Chris Withers wrote: >>> Anyone done any work on writing an interface for MailHost-like things >>> and then getting MailHost, MaildropHost, SecureMailHost and friends to >>> implement the interface and be registered as local utilities? >> I think Zope3 actually may have some stuff like that. CPSMailAccess >> uses it, I think. > > zope.sendmail? Yes, zope.sendmail (previously known as zope.app.mail) works fine on Zope 2. I would suggest using this one. -- http://worldcookery.com -- Professional Zope documentation and training 2nd edition of Web Component Development with Zope 3 is now shipping! From georgeleejr at gmail.com Tue Jan 9 00:57:07 2007 From: georgeleejr at gmail.com (George Lee) Date: Mon, 8 Jan 2007 23:57:07 +0000 (UTC) Subject: [z3-five] Customizing ZopeTwoPageTemplates through the web References: Message-ID: George Lee gmail.com> writes: > > Hi, > > What is the progress on work being done to make Zope3's ZopeTwoPageTemplates > customizable through the web? Ah: http://thread.gmane.org/gmane.comp.web.zope.plone.teams.framework/783 And also, I think work is being done on this in plone.app.layout Peace, George From me at rpatterson.net Tue Jan 9 08:54:17 2007 From: me at rpatterson.net (Ross Patterson) Date: Mon, 08 Jan 2007 23:54:17 -0800 Subject: [z3-five] Persistent Interfaces Message-ID: <87vejgzlcm.fsf@superfluity.lefae.org> I'm building a Zope2.10/Plone3 project using the CA wherever I can. I'm relying heavily on marker interfaces and I'm at a point where I need to allow a site administrator to create new marker interfaces to be used to mark content. I've looked at zodbcode, zope.app.module, and then finally found srichter's SchemaUtility work in zope.app.schema that was removed by jim in r69203. I'm only minimally able to make sense of this stuff, but none of it seems like what I'm looking for. I'd prefer to programatically create new interfaces than fake modules or other code object. Something like:: >>> from new import classobj >>> from zope.app.interface import PersistentInterface >>> app.IFoo = classobj('IFoo', (PersistentInterface,), dict(__doc__='IFoo')) >>> from zope.interface import directlyProvides >>> directlyProvides(app.index_html, app.IFoo) This actually all works except when the instance is stopped and restarted. When restarted, viewing index_html raises an error becuase the app.IFoo.depdndents PersistentDict is missing it's app.IFoo.depdndents.data attribute. I see that there's a zodbcode.patch.Wrapper used in zope.app.interface that seems like it's intended to resolve this issue but I have no idea how to use it. Actually, I don't have much idea what I'm doing at all, but I know what I want. :) I want to create marker interface programatically in response to a site administrators TTW actions and have them persist. I want to mark persistent objects as providing those interfaces (and, of course, have those declarations persist). In response to other site administrator TTW actions, I want to register adapters for objects that provide those marker interfaces and have those registrations persist (the adapters themselves need not persist, but that would be nice). I want this because the CA registry does exactly the kind of efficient lookup I'd like to do in this case. The only difference is that I don't want the marker interfaces and adapter registrations to be restricted to global code and I want them created through TTW actions. srichter, did SchemaUtility do what I'm talking about here? I see how it managed the persistent state of an interface established through global code, but I don't see how it could have resulted in the arbitrary creation of new interfaces TTW. Can you help me understand a little more what's going on there? Can anyone else advise on implementation directions or better design patterns? Ross From chris at simplistix.co.uk Tue Jan 9 09:21:52 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 09 Jan 2007 08:21:52 +0000 Subject: [z3-five] MailHosts as utilities In-Reply-To: <45A2CFD2.4050309@weitershausen.de> References: <4577E35D.6030805@simplistix.co.uk> <319e029f0612070320y5e6e84c0ye466d68acfb0b5d0@mail.gmail.com> <86D9AF3A9BF3B999CD88A467@suxmac2.local> <45A2CFD2.4050309@weitershausen.de> Message-ID: <45A350A0.2020901@simplistix.co.uk> Philipp von Weitershausen wrote: > Andreas Jung wrote: >>> On 12/7/06, Chris Withers wrote: >>>> Anyone done any work on writing an interface for MailHost-like things >>>> and then getting MailHost, MaildropHost, SecureMailHost and friends to >>>> implement the interface and be registered as local utilities? >>> I think Zope3 actually may have some stuff like that. CPSMailAccess >>> uses it, I think. >> zope.sendmail? > > Yes, zope.sendmail (previously known as zope.app.mail) works fine on > Zope 2. I would suggest using this one. This is kind of missing my point. There's currently MailHost, MaildropHost and one or two others that provide useful mailing functionality. However, selecting from available options is hard because you have to pass all the possible meta_types to superValues. It's to avoid this problem that I'd like to find a way to move mailing in Zope 2 to something interface-based, not because I want to use another implementation... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From optilude at gmx.net Tue Jan 9 14:07:36 2007 From: optilude at gmx.net (Martin Aspeli) Date: Tue, 09 Jan 2007 13:07:36 +0000 Subject: [z3-five] Customizing ZopeTwoPageTemplates through the web In-Reply-To: References: Message-ID: George Lee wrote: > George Lee gmail.com> writes: > >> Hi, >> >> What is the progress on work being done to make Zope3's ZopeTwoPageTemplates >> customizable through the web? > > > Ah: http://thread.gmane.org/gmane.comp.web.zope.plone.teams.framework/783 > > And also, I think work is being done on this in plone.app.layout No, plone.app.layout has nothing to do with this, though five.customerize is what you want. Philipp also just posted to the framework team list asking for help completing it. If you have bandwidth to help polish it up that would be major way of contributing to Plone 3! Martin From philipp at weitershausen.de Tue Jan 9 14:59:54 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 9 Jan 2007 14:59:54 +0100 Subject: [z3-five] MailHosts as utilities In-Reply-To: <45A350A0.2020901@simplistix.co.uk> References: <4577E35D.6030805@simplistix.co.uk> <319e029f0612070320y5e6e84c0ye466d68acfb0b5d0@mail.gmail.com> <86D9AF3A9BF3B999CD88A467@suxmac2.local> <45A2CFD2.4050309@weitershausen.de> <45A350A0.2020901@simplistix.co.uk> Message-ID: On 9 Jan 2007, at 09:21 , Chris Withers wrote: > Philipp von Weitershausen wrote: >> Andreas Jung wrote: >>>> On 12/7/06, Chris Withers wrote: >>>>> Anyone done any work on writing an interface for MailHost-like >>>>> things >>>>> and then getting MailHost, MaildropHost, SecureMailHost and >>>>> friends to >>>>> implement the interface and be registered as local utilities? >>>> I think Zope3 actually may have some stuff like that. CPSMailAccess >>>> uses it, I think. >>> zope.sendmail? >> Yes, zope.sendmail (previously known as zope.app.mail) works fine >> on Zope 2. I would suggest using this one. > > This is kind of missing my point. There's currently MailHost, > MaildropHost and one or two others that provide useful mailing > functionality. > > However, selecting from available options is hard because you have > to pass all the possible meta_types to superValues. > > It's to avoid this problem that I'd like to find a way to move > mailing in Zope 2 to something interface-based, not because I want > to use another implementation... I see. Well, it'd be useful, for starters, to implement a common IMailHost interface that is shared among those different implementations. They could then be registered as local persistent utilities for IMailHost. From rocky at serverzen.com Tue Jan 9 15:40:17 2007 From: rocky at serverzen.com (Rocky Burt) Date: Tue, 09 Jan 2007 11:10:17 -0330 Subject: [z3-five] MailHosts as utilities In-Reply-To: References: <4577E35D.6030805@simplistix.co.uk> <319e029f0612070320y5e6e84c0ye466d68acfb0b5d0@mail.gmail.com> <86D9AF3A9BF3B999CD88A467@suxmac2.local> <45A2CFD2.4050309@weitershausen.de> <45A350A0.2020901@simplistix.co.uk> Message-ID: <1168353614.21802.331.camel@localhost> On Tue, 2007-09-01 at 14:59 +0100, Philipp von Weitershausen wrote: > I see. Well, it'd be useful, for starters, to implement a common > IMailHost interface that is shared among those different > implementations. They could then be registered as local persistent > utilities for IMailHost. Well, whatever interface we end up using the need I see is as follows: 1) use existing zope3 mail interface (or create new one like IMailHost) 2) make sure global utility exists for this interface 3) make persistent version of utility that can be registered locally and stores it's settings internally 4) introduce MailHost BBB class for CMF that proxies for the new local utility and spews deprecation warnings We've been toying with this plan for Plone but no one has managed to get time to do it. - Rocky -- Rocky Burt ServerZen Software -- http://www.serverzen.com News About The Server (blog) -- http://www.serverzen.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20070109/60931ef2/attachment.pgp From georgeleejr at gmail.com Tue Jan 9 16:55:20 2007 From: georgeleejr at gmail.com (George Lee) Date: Tue, 9 Jan 2007 15:55:20 +0000 (UTC) Subject: [z3-five] Customizing ZopeTwoPageTemplates through the web References: Message-ID: Martin Aspeli gmx.net> writes: > > George Lee wrote: > > George Lee gmail.com> writes: > > > >> Hi, > >> > >> What is the progress on work being done to make Zope3's ZopeTwoPageTemplates > >> customizable through the web? > > No, plone.app.layout has nothing to do with this Whoops, I meant plone.app.form: http://dev.plone.org/plone/browser/plone.app.form/trunk/plone/app/form/_named.py But five.customerize is really the one to look at. Peace, George From chris at simplistix.co.uk Wed Jan 10 12:55:06 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 10 Jan 2007 11:55:06 +0000 Subject: [z3-five] [Fwd: [Zope-dev] [Warning] Zope 3 component architecture (CA) not reliably usable for registrations from Python] Message-ID: <45A4D41A.8080008@simplistix.co.uk> Does this belong on this list or zope3-dev? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk -------------- next part -------------- An embedded message was scrubbed... From: "Dieter Maurer" Subject: [Zope-dev] [Warning] Zope 3 component architecture (CA) not reliably usable for registrations from Python Date: Wed, 10 Jan 2007 10:01:23 +0100 Size: 3958 Url: http://codespeak.net/pipermail/z3-five/attachments/20070110/3d660617/attachment-0001.eml From chris at simplistix.co.uk Wed Jan 10 12:53:13 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 10 Jan 2007 11:53:13 +0000 Subject: [z3-five] MailHosts as utilities In-Reply-To: <1168353614.21802.331.camel@localhost> References: <4577E35D.6030805@simplistix.co.uk> <319e029f0612070320y5e6e84c0ye466d68acfb0b5d0@mail.gmail.com> <86D9AF3A9BF3B999CD88A467@suxmac2.local> <45A2CFD2.4050309@weitershausen.de> <45A350A0.2020901@simplistix.co.uk> <1168353614.21802.331.camel@localhost> Message-ID: <45A4D3A9.9010408@simplistix.co.uk> Rocky Burt wrote: > Well, whatever interface we end up using the need I see is as follows: > > 1) use existing zope3 mail interface (or create new one like > IMailHost) I wonder what the existing zope3 mail interfaces looks like? I'd be pleasantly surprised if MailHost already has the required methods :-) > 2) make sure global utility exists for this interface Really? I'd prefer no global utility were available by default - possible spam sources should not exist by default... > 3) make persistent version of utility that can be registered locally > and stores it's settings internally I'd like to see existing MailHost-ish things fulfill this roll. > 4) introduce MailHost BBB class for CMF that proxies for the new local > utility and spews deprecation warnings I don't see a need for this. cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Wed Jan 10 18:18:20 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 10 Jan 2007 18:18:20 +0100 Subject: [z3-five] [Fwd: [Zope-dev] [Warning] Zope 3 component architecture (CA) not reliably usable for registrations from Python] In-Reply-To: <45A4D41A.8080008@simplistix.co.uk> References: <45A4D41A.8080008@simplistix.co.uk> Message-ID: <45A51FDC.4090604@weitershausen.de> Chris Withers wrote: > Does this belong on this list or zope3-dev? If at all, it should've been on zope3-dev. > Subject: > [Zope-dev] [Warning] Zope 3 component architecture (CA) not reliably > usable for registrations from Python > From: > "Dieter Maurer" > Date: > Wed, 10 Jan 2007 10:01:23 +0100 > To: > zope at zope.org, zope-dev at zope.org > > To: > zope at zope.org, zope-dev at zope.org > CC: > > > I tried to use Zope3 events to get informed when requests start and end. > > One of our modules (the interface module to "jpype") requires such > a notification for reliable work. Therefore, it tried to register > the corresponding subscriptions on import of this module. > Unfortunately, this works very unreliably -- for the following reasons: > > > The CA performs by itself only extremely minimal initialization. > Especially, it does not register the "Adapters" service, necessary > for the registration of event subscriptions. > > The full CA initialization is only performed quite late, in the call > to "Products.Five.initialize". > Event notification registration attempts before this time will fail > (with a "ComponentLookupError: 'Adapters'"), > those performed after this time will succeed. > > The "Five" initialization is stupid enough that it will fail > when the service registration for 'Adapters' has already been performed. > > > At the current state, event notifications can reliably only be defined > via ZCML. This is unfortunate for our use case where the registration > should be bound to the import of a given module. > > > -- http://worldcookery.com -- Professional Zope documentation and training 2nd edition of Web Component Development with Zope 3 is now shipping! From y.2007- at wcm-solutions.de Wed Jan 10 18:28:42 2007 From: y.2007- at wcm-solutions.de (yuppie) Date: Wed, 10 Jan 2007 18:28:42 +0100 Subject: [z3-five] Zope 2.10.2 coming up In-Reply-To: <45A207A0.8080903@weitershausen.de> References: <45A0FA3B.5070901@wcm-solutions.de> <45A207A0.8080903@weitershausen.de> Message-ID: <45A5224A.5030805@wcm-solutions.de> Hi! Philipp von Weitershausen wrote: > yuppie wrote: >> >> The Zope 2.10 branch still uses Five 1.5.1. There are a few changes on >> the Five 1.5 branch (including a security fix) which should become >> part of Zope 2.10.2. >> >> I volunteer to resolve this as follows: >> >> Five releases are now linked tightly to specific Zope releases, so it >> doesn't make much sense to do still separate Five releases. See this >> thread: >> http://codespeak.net/pipermail/z3-five/2006q4/001889.html >> >> If there are no objections, I'll stitch the Five 1.5 branch HEAD >> directly into the Zope 2.10 branch (without using svn externals) and >> Five trunk HEAD into the Zope trunk. This would mean that from now on >> Five 1.5 and 1.6 are maintained as part of Zope 2. In fact there will >> be no Five 1.5.2 or 1.6 because there will no longer be any separate >> releases. >> >> Thoughts? > > + sys.maxint > For the records: After some more off-list discussion with Philipp I decided to move only the trunk. This is done now. The 1.5 branch still exists and Philipp tagged Five 1.5.2 for Zope 2.10.2. Cheers, Yuppie From lists at zopyx.com Wed Jan 10 18:31:29 2007 From: lists at zopyx.com (Andreas Jung) Date: Wed, 10 Jan 2007 18:31:29 +0100 Subject: [z3-five] [Zope-dev] Re: Zope 2.10.2 coming up In-Reply-To: <45A5224A.5030805@wcm-solutions.de> References: <45A0FA3B.5070901@wcm-solutions.de> <45A207A0.8080903@weitershausen.de> <45A5224A.5030805@wcm-solutions.de> Message-ID: <07F09054C101046229406752@217-22-205-96.rev-ptr.fmsweb.de> --On 10. Januar 2007 18:28:42 +0100 yuppie wrote: > Hi! > > > Philipp von Weitershausen wrote: >> yuppie wrote: >>> >>> The Zope 2.10 branch still uses Five 1.5.1. There are a few changes on >>> the Five 1.5 branch (including a security fix) which should become >>> part of Zope 2.10.2. >>> >>> I volunteer to resolve this as follows: >>> >>> Five releases are now linked tightly to specific Zope releases, so it >>> doesn't make much sense to do still separate Five releases. See this >>> thread: >>> http://codespeak.net/pipermail/z3-five/2006q4/001889.html >>> >>> If there are no objections, I'll stitch the Five 1.5 branch HEAD >>> directly into the Zope 2.10 branch (without using svn externals) and >>> Five trunk HEAD into the Zope trunk. This would mean that from now on >>> Five 1.5 and 1.6 are maintained as part of Zope 2. In fact there will >>> be no Five 1.5.2 or 1.6 because there will no longer be any separate >>> releases. >>> >>> Thoughts? >> >> + sys.maxint >> > > For the records: > > After some more off-list discussion with Philipp I decided to move only > the trunk. This is done now. > > The 1.5 branch still exists and Philipp tagged Five 1.5.2 for Zope 2.10.2. > > > Thank you both! Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20070110/f11eaecc/attachment.pgp From philipp at weitershausen.de Wed Jan 10 19:33:32 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 10 Jan 2007 19:33:32 +0100 Subject: [z3-five] MailHosts as utilities In-Reply-To: <45A4D3A9.9010408@simplistix.co.uk> References: <4577E35D.6030805@simplistix.co.uk> <319e029f0612070320y5e6e84c0ye466d68acfb0b5d0@mail.gmail.com> <86D9AF3A9BF3B999CD88A467@suxmac2.local> <45A2CFD2.4050309@weitershausen.de> <45A350A0.2020901@simplistix.co.uk> <1168353614.21802.331.camel@localhost> <45A4D3A9.9010408@simplistix.co.uk> Message-ID: <45A5317C.2020302@weitershausen.de> Chris Withers wrote: > Rocky Burt wrote: >> Well, whatever interface we end up using the need I see is as follows: >> >> 1) use existing zope3 mail interface (or create new one like >> IMailHost) > > I wonder what the existing zope3 mail interfaces looks like? I'd be > pleasantly surprised if MailHost already has the required methods :-) Gee, Chris. If only you could see the source code of Zope 3 or there was a tool that would let you inspect every interface in Zope 3 or there was a book that covered this... Shame, shame... >> 2) make sure global utility exists for this interface > > Really? I'd prefer no global utility were available by default - > possible spam sources should not exist by default... Right, that doesn't seem like a necessity. It's certainly not the case in Zope 3. Sending emails is highly deployment specific. >> 3) make persistent version of utility that can be registered locally >> and stores it's settings internally > > I'd like to see existing MailHost-ish things fulfill this roll. Sure, though it'd be nice to have the same interface for both global utilities that can be defined in Zope 3 and local ones. Then code wanting to send emails wouldn't have to bother which one it wnats. -- http://worldcookery.com -- Professional Zope documentation and training 2nd edition of Web Component Development with Zope 3 is now shipping! From philipp at weitershausen.de Wed Jan 10 19:39:02 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 10 Jan 2007 19:39:02 +0100 Subject: [z3-five] HEADS UP: Five trunk no longer exists Message-ID: Just wanted to let you know that Yvo has integrated Five trunk into the Zope 2 trunk as planned. Thank you Yvo. Five 1.5.x was not moved and probably won't be. Bugfixes now need to go into Five 1.3, 1.4, 1.5 and the Zope 2 trunk. -- http://worldcookery.com -- Professional Zope documentation and training 2nd edition of Web Component Development with Zope 3 is now shipping! From chris at simplistix.co.uk Wed Jan 10 22:06:55 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 10 Jan 2007 21:06:55 +0000 Subject: [z3-five] HEADS UP: Five trunk no longer exists In-Reply-To: References: Message-ID: <45A5556F.4040009@simplistix.co.uk> Philipp von Weitershausen wrote: > Just wanted to let you know that Yvo has integrated Five trunk into the > Zope 2 trunk as planned. Thank you Yvo. I'd recommend actually deleting the trunk then, if this hasn't already been done... > Five 1.5.x was not moved and probably won't be. > > Bugfixes now need to go into Five 1.3, 1.4, 1.5 and the Zope 2 trunk. Wow, that's a lot of maintenance branches :-( Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Wed Jan 10 22:05:17 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 10 Jan 2007 21:05:17 +0000 Subject: [z3-five] MailHosts as utilities In-Reply-To: <45A5317C.2020302@weitershausen.de> References: <4577E35D.6030805@simplistix.co.uk> <319e029f0612070320y5e6e84c0ye466d68acfb0b5d0@mail.gmail.com> <86D9AF3A9BF3B999CD88A467@suxmac2.local> <45A2CFD2.4050309@weitershausen.de> <45A350A0.2020901@simplistix.co.uk> <1168353614.21802.331.camel@localhost> <45A4D3A9.9010408@simplistix.co.uk> <45A5317C.2020302@weitershausen.de> Message-ID: <45A5550D.8080108@simplistix.co.uk> Philipp von Weitershausen wrote: >>> 3) make persistent version of utility that can be registered locally >>> and stores it's settings internally >> >> I'd like to see existing MailHost-ish things fulfill this roll. > > Sure, though it'd be nice to have the same interface for both global > utilities that can be defined in Zope 3 and local ones. Then code > wanting to send emails wouldn't have to bother which one it wnats. Isn't this what adapters are for? It'd be unpleasantly surprised if an adapter from Zope 3's mailer interface to IMailHost isn't quite easy to right. Sadly, I'm guessing if you try to get a utility that implements IMailHost, it won't pick up global zope3 mailers, even though there is an adapter for them... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Thu Jan 11 00:10:04 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 11 Jan 2007 00:10:04 +0100 Subject: [z3-five] HEADS UP: Five trunk no longer exists In-Reply-To: <45A5556F.4040009@simplistix.co.uk> References: <45A5556F.4040009@simplistix.co.uk> Message-ID: On 10 Jan 2007, at 22:06 , Chris Withers wrote: > Philipp von Weitershausen wrote: >> Just wanted to let you know that Yvo has integrated Five trunk >> into the Zope 2 trunk as planned. Thank you Yvo. > > I'd recommend actually deleting the trunk then, if this hasn't > already been done... It's been done. It's just a README.txt pointing to the new location now. >> Five 1.5.x was not moved and probably won't be. >> Bugfixes now need to go into Five 1.3, 1.4, 1.5 and the Zope 2 trunk. > > Wow, that's a lot of maintenance branches :-( Tell me about it. From faassen at startifact.com Thu Jan 11 19:38:10 2007 From: faassen at startifact.com (Martijn Faassen) Date: Thu, 11 Jan 2007 19:38:10 +0100 Subject: [z3-five] registering Browser Skins Message-ID: Hi there, I think I just noticed a missing utility registration in Five (in Zope 2.10.1). I am unable to access the 'Browser Skins' vocabulary unless I add this to my own ZCML: I think that this can safely be part of Five. What do you think? Regards, Martijn From philipp at weitershausen.de Fri Jan 12 00:52:58 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Fri, 12 Jan 2007 00:52:58 +0100 Subject: [z3-five] registering Browser Skins In-Reply-To: References: Message-ID: <45A6CDDA.5070300@weitershausen.de> Martijn Faassen wrote: > Hi there, > > I think I just noticed a missing utility registration in Five (in Zope > 2.10.1). I am unable to access the 'Browser Skins' vocabulary unless I > add this to my own ZCML: > > name="Browser Skins" > component="zope.app.publisher.browser.vocabulary.BrowserSkinsVocabulary" > /> > > I think that this can safely be part of Five. What do you think? +1 -- http://worldcookery.com -- Professional Zope documentation and training 2nd edition of Web Component Development with Zope 3 is now shipping! From d.schulz81 at gmx.net Tue Jan 16 10:40:29 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Tue, 16 Jan 2007 10:40:29 +0100 Subject: [z3-five] local utility with zope 2.9.5 Message-ID: <45AC9D8D.2020808@gmx.net> Hi, I would like (no I not really like, I have to) to register a local utility with zope 2.9.5 and Five 1.4.2. (I know that it is more trouble than with the new zope version but I really have to finish something on the current Plone 2.5.) I found the following example: https://svn.openplans.org/svn/topp.rose/trunk/utility.py I tried it out (see below code) and I get always the message "IPossibleSite" not provided. Do I have to register the utility on my Application or on the Plone Site? Both of them do not provide IPossibleSite. When I explicitly provide IPossibleSite (directlyProvides(app,IPossibleSite)) the call sm = app.getSiteManager() raises an attribute error afterwards..... Below there code of the registration is attached. I call it in the Extensions/install.py of my archetype based product. Anything wrong with this? Could anyone tell me if this is the right approach or point me to some other example? Dennis from ore.annotation import UtilityAnnotation,annotationAdapter,AnnotationUtility from ore.annotation.interfaces import IAnnotationUtility,IUtilityAnnotatable try: from OFS.Application import Application from OFS.SimpleItem import SimpleItem class OFSAnnotationUtility(SimpleItem, AnnotationUtility): """ Zope2 friendly Util """ except ImportError: pass def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) """ add local utility in zope2 """ app = self print "before" print app from zope.app.component.interfaces import IPossibleSite from zope.interface import directlyProvides from Products.Five.site.localsite import enableLocalSiteHook findroot = True # from alecm's 'listen' if findroot: # find the zope application root app = aq_inner(app) while app is not None and not isinstance(app, Application): app = aq_parent(app) print "after" print app # If we have the zope Application and the utility is not yet # registered, then register it. if (app is not None and zapi.queryUtility(IAnnotationUtility, default=None) is None): enableLocalSiteHook(app) setSite(app) sm = app.getSiteManager() sm.registerUtility(IAnnotationUtility, AnnotationUtility(NAME)) out.write("Successfully Yeah Yeah installed %s." % PROJECTNAME) return out.getvalue() From rocky at serverzen.com Tue Jan 16 12:47:27 2007 From: rocky at serverzen.com (Rocky Burt) Date: Tue, 16 Jan 2007 08:17:27 -0330 Subject: [z3-five] local utility with zope 2.9.5 In-Reply-To: <45AC9D8D.2020808@gmx.net> References: <45AC9D8D.2020808@gmx.net> Message-ID: <1168948044.7724.43.camel@localhost> On Tue, 2007-16-01 at 10:40 +0100, Dennis Schulz wrote: > I tried it out (see below code) and I get always the message > "IPossibleSite" not provided. > Do I have to register the utility on my Application or on the Plone > Site? Both of them do not provide IPossibleSite. > When I explicitly provide IPossibleSite > (directlyProvides(app,IPossibleSite)) the call sm = > app.getSiteManager() raises an attribute error afterwards..... > > Below there code of the registration is attached. > I call it in the Extensions/install.py of my archetype based product. > Anything wrong with this? Your install code looks good and yes on Zope 2.10 that would just work. The problem is that none of the container classes provided by Zope 2.9 are actually proper IPossibleSite's. But Five provides a way to make them IPossibleSite's properly. I believe the two steps you're missing are better suited to ZCML. 1) make the class implement IPossibleSite 2) monkey patch Application class to properly meet the IPossibleSite contract Basically in Zope 2.9 you need to do those steps before you can try to treat any class instance as an IPossibleSite (in my apps I tend to make the plone site a local site by doing something similar). - Rocky -- Rocky Burt ServerZen Software -- http://www.serverzen.com News About The Server (blog) -- http://www.serverzen.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20070116/800c8d40/attachment.pgp From d.schulz81 at gmx.net Tue Jan 16 13:15:28 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Tue, 16 Jan 2007 13:15:28 +0100 Subject: [z3-five] local utility with zope 2.9.5 Message-ID: <45ACC1E0.1060805@gmx.net> I registed Plone Site as Five Site and tried to register the local utility. now the install script goes further, but ends up with TypeError: ('Could not adapt', , ) I also made my own content type that subclasses FiveSite and implementes IPossibleSite and for my needs it would be perfectly sufficient to register the utility only inside the content type......... .......but how can I reach it from the install method of my zope 2 product? .......or how to do it in general? 2007-01-16 12:55:36 ERROR Zope.SiteErrorLog http://localhost:8080/dd/portal_quickinstaller/installProducts Traceback (innermost last): Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 326, in installProduct - __traceback_info__: ('PurchaseRequisition',) Module transaction._manager, line 96, in commit Module transaction._transaction, line 366, in commit Module transaction._transaction, line 295, in savepoint Module transaction._transaction, line 292, in savepoint Module transaction._transaction, line 675, in __init__ Module ZODB.Connection, line 1012, in savepoint Module ZODB.Connection, line 526, in _commit Module ZODB.Connection, line 553, in _store_objects Module ZODB.serialize, line 407, in serialize Module ZODB.serialize, line 415, in _dump PicklingError: Can't pickle : attribute lookup __builtin__.OFSAnnotationUtility failed C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py:348: DeprecationWarning: This will be removed in ZODB 3.7: subtransactions are deprecated; use sp.rollback() instead of transaction.abort(1), where `sp` is the corresponding savepoint captured earlier transaction.abort(1) #this is very naughty 2007-01-16 12:55:36 ERROR Zope.SiteErrorLog http://localhost:8080/dd/portal_quickinstaller/installProducts Traceback (innermost last): Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 413, in installProduct - __traceback_info__: ('PurchaseRequisition',) Module Products.CMFQuickInstallerTool.InstalledProduct, line 99, in update Module ZODB.Connection, line 857, in register Module ZODB.Connection, line 867, in _register Module transaction._transaction, line 256, in join Module transaction._transaction, line 250, in _prior_operation_failed TransactionFailedError: An operation previously failed, with traceback: File "C:\Python\Zope\Zope\lib\python\ZServer\PubCore\ZServerPublisher.py", line 23, in __init__ response=response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 395, in publish_module environ, debug, request, response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 196, in publish_module_standard response = publish(request, module_name, after_list, debug=debug) File "C:\Python\Zope\Instance\Products\PlacelessTranslationService\PatchStringIO.py", line 34, in new_publish x = Publish.old_publish(request, module_name, after_list, debug) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 115, in publish request, bind=1) File "C:\Python\Zope\Zope\lib\python\ZPublisher\mapply.py", line 88, in mapply if debug is not None: return debug(object,args,context) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 41, in call_object result=apply(object,args) # Type s to step into published object. File "C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 454, in installProducts reinstall=reinstall) File "C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 326, in installProduct transaction.commit(1) File "C:\Python\Zope\Zope\lib\python\transaction\_manager.py", line 96, in commit return self.get().commit(sub, deprecation_wng=False) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 366, in commit self._subtransaction_savepoint = self.savepoint(optimistic=True) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 295, in savepoint self._saveCommitishError() # reraises! File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 292, in savepoint savepoint = Savepoint(self, optimistic, *self._resources) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 675, in __init__ savepoint = savepoint() File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 1012, in savepoint self._commit(None) File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 526, in _commit self._store_objects(ObjectWriter(obj), transaction) File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 553, in _store_objects p = writer.serialize(obj) # This calls __getstate__ of obj File "C:\Python\Zope\Zope\lib\python\ZODB\serialize.py", line 407, in serialize return self._dump(meta, obj.__getstate__()) File "C:\Python\Zope\Zope\lib\python\ZODB\serialize.py", line 415, in _dump self._p.dump(classmeta) PicklingError: Can't pickle : attribute lookup __builtin__.OFSAnnotationUtility failed C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py:426: DeprecationWarning: This will be removed in ZODB 3.7: subtransactions are deprecated; use sp.rollback() instead of transaction.abort(1), where `sp` is the corresponding savepoint captured earlier transaction.abort(1) #this is very naughty 2007-01-16 12:55:36 ERROR Zope.SiteErrorLog http://localhost:8080/dd/portal_quickinstaller/installProducts Traceback (innermost last): Module ZPublisher.Publish, line 121, in publish Module Zope2.App.startup, line 240, in commit Module transaction._manager, line 96, in commit Module transaction._transaction, line 370, in commit Module transaction._transaction, line 250, in _prior_operation_failed TransactionFailedError: An operation previously failed, with traceback: File "C:\Python\Zope\Zope\lib\python\ZServer\PubCore\ZServerPublisher.py", line 23, in __init__ response=response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 395, in publish_module environ, debug, request, response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 196, in publish_module_standard response = publish(request, module_name, after_list, debug=debug) File "C:\Python\Zope\Instance\Products\PlacelessTranslationService\PatchStringIO.py", line 34, in new_publish x = Publish.old_publish(request, module_name, after_list, debug) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 115, in publish request, bind=1) File "C:\Python\Zope\Zope\lib\python\ZPublisher\mapply.py", line 88, in mapply if debug is not None: return debug(object,args,context) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 41, in call_object result=apply(object,args) # Type s to step into published object. File "C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 454, in installProducts reinstall=reinstall) File "C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 326, in installProduct transaction.commit(1) File "C:\Python\Zope\Zope\lib\python\transaction\_manager.py", line 96, in commit return self.get().commit(sub, deprecation_wng=False) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 366, in commit self._subtransaction_savepoint = self.savepoint(optimistic=True) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 295, in savepoint self._saveCommitishError() # reraises! File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 292, in savepoint savepoint = Savepoint(self, optimistic, *self._resources) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 675, in __init__ savepoint = savepoint() File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 1012, in savepoint self._commit(None) File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 526, in _commit self._store_objects(ObjectWriter(obj), transaction) File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 553, in _store_objects p = writer.serialize(obj) # This calls __getstate__ of obj File "C:\Python\Zope\Zope\lib\python\ZODB\serialize.py", line 407, in serialize return self._dump(meta, obj.__getstate__()) File "C:\Python\Zope\Zope\lib\python\ZODB\serialize.py", line 415, in _dump self._p.dump(classmeta) PicklingError: Can't pickle : attribute lookup __builtin__.OFSAnnotationUtility failed 2007-01-16 12:55:36 ERROR root Exception while rendering an error message Traceback (most recent call last): File "C:\Python\Zope\Zope\lib\python\OFS\SimpleItem.py", line 223, in raise_standardErrorMessage v = s(**kwargs) File "C:\Python\Zope\Instance\Products\CMFCore\FSPythonScript.py", line 108, in __call__ return Script.__call__(self, *args, **kw) File "C:\Python\Zope\Zope\lib\python\Shared\DC\Scripts\Bindings.py", line 311, in __call__ return self._bindAndExec(args, kw, None) File "C:\Python\Zope\Zope\lib\python\Shared\DC\Scripts\Bindings.py", line 348, in _bindAndExec return self._exec(bound_data, args, kw) File "C:\Python\Zope\Instance\Products\CMFCore\FSPythonScript.py", line 164, in _exec result = f(*args, **kw) File "Script (Python)", line 16, in standard_error_message File "C:\Python\Zope\Zope\lib\python\Shared\DC\Scripts\Bindings.py", line 311, in __call__ return self._bindAndExec(args, kw, None) File "C:\Python\Zope\Zope\lib\python\Shared\DC\Scripts\Bindings.py", line 348, in _bindAndExec return self._exec(bound_data, args, kw) File "C:\Python\Zope\Instance\Products\CMFCore\FSPageTemplate.py", line 195, in _exec result = self.pt_render(extra_context=bound_names) File "C:\Python\Zope\Instance\Products\CMFCore\FSPageTemplate.py", line 134, in pt_render result = FSPageTemplate.inheritedAttribute('pt_render')( File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\PageTemplate.py", line 104, in pt_render tal=not source, strictinsert=0)() File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 238, in __call__ self.interpret(self.program) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 281, in interpret handlers[opcode](self, args) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 749, in do_useMacro self.interpret(macro) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 281, in interpret handlers[opcode](self, args) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 457, in do_optTag_tal self.do_optTag(stuff) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 442, in do_optTag return self.no_tag(start, program) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 437, in no_tag self.interpret(program) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 281, in interpret handlers[opcode](self, args) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 749, in do_useMacro self.interpret(macro) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 281, in interpret handlers[opcode](self, args) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 507, in do_setLocal_tal self.engine.setLocal(name, self.engine.evaluateValue(expr)) File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\TALES.py", line 221, in evaluate return expression(self) File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\Expressions.py", line 185, in __call__ return self._eval(econtext) File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\Expressions.py", line 180, in _eval return render(ob, econtext.vars) File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\Expressions.py", line 85, in render ob = ob() File "C:\Python\Zope\Instance\Products\CMFPlone\browser\plone.py", line 66, in globalize self._initializeData(options=options) File "C:\Python\Zope\Instance\Products\CMFPlone\browser\plone.py", line 118, in _initializeData self._data['actions'] = actions = (options.get('actions', None) or File "C:\Python\Zope\Instance\Products\CMFPlone\ActionsTool.py", line 46, in listFilteredActionsFor [self._getActions(provider_name, actions, object) \ File "C:\Python\Zope\Instance\Products\CMFPlone\ActionsTool.py", line 34, in _getActions actions.extend( provider.listActionInfos(object=object) ) File "C:\Python\Zope\Instance\Products\CMFCore\ActionProviderBase.py", line 86, in listActionInfos actions = self.listActions(object=object) File "C:\PLONE\Data\Products\CMFonFive\fiveactionstool.py", line 139, in listActions for menu_id in _listMenuIds(): File "C:\PLONE\Data\Products\CMFonFive\fiveactionstool.py", line 32, in _listMenuIds return [id for id, utility in zapi.getUtilitiesFor(IBrowserMenu)] File "C:\Python\Zope\Zope\lib\python\zope\component\__init__.py", line 263, in getUtilitiesFor return getSiteManager(context).getUtilitiesFor(interface) File "C:\PLONE\Data\Products\Five\site\localsite.py", line 142, in getUtilitiesFor File "C:\PLONE\Data\Products\Five\site\localsite.py", line 121, in utilities File "C:\Python\Zope\Zope\lib\python\zope\interface\interface.py", line 682, in __call__ raise TypeError("Could not adapt", obj, self) TypeError: ('Could not adapt', , ) From d.schulz81 at gmx.net Tue Jan 16 14:05:40 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Tue, 16 Jan 2007 14:05:40 +0100 Subject: [z3-five] local utility with zope 2.9.5 In-Reply-To: <1168948044.7724.43.camel@localhost> References: <45AC9D8D.2020808@gmx.net> <1168948044.7724.43.camel@localhost> Message-ID: <45ACCDA4.9040800@gmx.net> Thanks for the help, now I money patched OFS.Application as a site, but unfortunately the same error as when I try the register on the Plone Site. (See traceback at the end.) Can't pickle , maybe is it bad to mix it with OFS.SimpleItem to get it zope2 compatible? Or IOBTree can't be pickled? Here is the utility I want to register: class AnnotationUtility( Persistent ): def __init__(self): self.annotations = IOBTree() def get( self, context ): utility = component.getUtility( IIntIds, context=self ) iid = utility.getId( context ) if not self.annotations.has_key( iid ): self.create( iid ) return iid, self.annotations.get( iid ) def create( self, intid ): state = OOBTree() self.annotations[ intid ] = state 2007-01-16 14:00:46 ERROR Zope.SiteErrorLog http://localhost:8080/dd/portal_quickinstaller/installProducts Traceback (innermost last): Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 326, in installProduct - __traceback_info__: ('PurchaseRequisition',) Module transaction._manager, line 96, in commit Module transaction._transaction, line 366, in commit Module transaction._transaction, line 295, in savepoint Module transaction._transaction, line 292, in savepoint Module transaction._transaction, line 675, in __init__ Module ZODB.Connection, line 1012, in savepoint Module ZODB.Connection, line 526, in _commit Module ZODB.Connection, line 553, in _store_objects Module ZODB.serialize, line 407, in serialize Module ZODB.serialize, line 415, in _dump PicklingError: Can't pickle : attribute lookup __builtin__.OFSAnnotationUtility failed C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py:348: DeprecationWarning: This will be removed in ZODB 3.7: subtransactions are deprecated; use sp.rollback() instead of transaction.abort(1), where `sp` is the corresponding savepoint captured earlier transaction.abort(1) #this is very naughty 2007-01-16 14:00:46 ERROR Zope.SiteErrorLog http://localhost:8080/dd/portal_quickinstaller/installProducts Traceback (innermost last): Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 413, in installProduct - __traceback_info__: ('PurchaseRequisition',) Module Products.CMFQuickInstallerTool.InstalledProduct, line 99, in update Module ZODB.Connection, line 857, in register Module ZODB.Connection, line 867, in _register Module transaction._transaction, line 256, in join Module transaction._transaction, line 250, in _prior_operation_failed TransactionFailedError: An operation previously failed, with traceback: File "C:\Python\Zope\Zope\lib\python\ZServer\PubCore\ZServerPublisher.py", line 23, in __init__ response=response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 395, in publish_module environ, debug, request, response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 196, in publish_module_standard response = publish(request, module_name, after_list, debug=debug) File "C:\Python\Zope\Instance\Products\PlacelessTranslationService\PatchStringIO.py", line 34, in new_publish x = Publish.old_publish(request, module_name, after_list, debug) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 115, in publish request, bind=1) File "C:\Python\Zope\Zope\lib\python\ZPublisher\mapply.py", line 88, in mapply if debug is not None: return debug(object,args,context) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 41, in call_object result=apply(object,args) # Type s to step into published object. File "C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 454, in installProducts reinstall=reinstall) File "C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 326, in installProduct transaction.commit(1) File "C:\Python\Zope\Zope\lib\python\transaction\_manager.py", line 96, in commit return self.get().commit(sub, deprecation_wng=False) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 366, in commit self._subtransaction_savepoint = self.savepoint(optimistic=True) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 295, in savepoint self._saveCommitishError() # reraises! File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 292, in savepoint savepoint = Savepoint(self, optimistic, *self._resources) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 675, in __init__ savepoint = savepoint() File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 1012, in savepoint self._commit(None) File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 526, in _commit self._store_objects(ObjectWriter(obj), transaction) File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 553, in _store_objects p = writer.serialize(obj) # This calls __getstate__ of obj File "C:\Python\Zope\Zope\lib\python\ZODB\serialize.py", line 407, in serialize return self._dump(meta, obj.__getstate__()) File "C:\Python\Zope\Zope\lib\python\ZODB\serialize.py", line 415, in _dump self._p.dump(classmeta) PicklingError: Can't pickle : attribute lookup __builtin__.OFSAnnotationUtility failed C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py:426: DeprecationWarning: This will be removed in ZODB 3.7: subtransactions are deprecated; use sp.rollback() instead of transaction.abort(1), where `sp` is the corresponding savepoint captured earlier transaction.abort(1) #this is very naughty 2007-01-16 14:00:46 ERROR Zope.SiteErrorLog http://localhost:8080/dd/portal_quickinstaller/installProducts Traceback (innermost last): Module ZPublisher.Publish, line 121, in publish Module Zope2.App.startup, line 240, in commit Module transaction._manager, line 96, in commit Module transaction._transaction, line 370, in commit Module transaction._transaction, line 250, in _prior_operation_failed TransactionFailedError: An operation previously failed, with traceback: File "C:\Python\Zope\Zope\lib\python\ZServer\PubCore\ZServerPublisher.py", line 23, in __init__ response=response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 395, in publish_module environ, debug, request, response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 196, in publish_module_standard response = publish(request, module_name, after_list, debug=debug) File "C:\Python\Zope\Instance\Products\PlacelessTranslationService\PatchStringIO.py", line 34, in new_publish x = Publish.old_publish(request, module_name, after_list, debug) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 115, in publish request, bind=1) File "C:\Python\Zope\Zope\lib\python\ZPublisher\mapply.py", line 88, in mapply if debug is not None: return debug(object,args,context) File "C:\Python\Zope\Zope\lib\python\ZPublisher\Publish.py", line 41, in call_object result=apply(object,args) # Type s to step into published object. File "C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 454, in installProducts reinstall=reinstall) File "C:\Python\Zope\Instance\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 326, in installProduct transaction.commit(1) File "C:\Python\Zope\Zope\lib\python\transaction\_manager.py", line 96, in commit return self.get().commit(sub, deprecation_wng=False) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 366, in commit self._subtransaction_savepoint = self.savepoint(optimistic=True) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 295, in savepoint self._saveCommitishError() # reraises! File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 292, in savepoint savepoint = Savepoint(self, optimistic, *self._resources) File "C:\Python\Zope\Zope\lib\python\transaction\_transaction.py", line 675, in __init__ savepoint = savepoint() File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 1012, in savepoint self._commit(None) File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 526, in _commit self._store_objects(ObjectWriter(obj), transaction) File "C:\Python\Zope\Zope\lib\python\ZODB\Connection.py", line 553, in _store_objects p = writer.serialize(obj) # This calls __getstate__ of obj File "C:\Python\Zope\Zope\lib\python\ZODB\serialize.py", line 407, in serialize return self._dump(meta, obj.__getstate__()) File "C:\Python\Zope\Zope\lib\python\ZODB\serialize.py", line 415, in _dump self._p.dump(classmeta) PicklingError: Can't pickle : attribute lookup __builtin__.OFSAnnotationUtility failed 2007-01-16 14:00:46 ERROR root Exception while rendering an error message Traceback (most recent call last): File "C:\Python\Zope\Zope\lib\python\OFS\SimpleItem.py", line 223, in raise_standardErrorMessage v = s(**kwargs) File "C:\Python\Zope\Instance\Products\CMFCore\FSPythonScript.py", line 108, in __call__ return Script.__call__(self, *args, **kw) File "C:\Python\Zope\Zope\lib\python\Shared\DC\Scripts\Bindings.py", line 311, in __call__ return self._bindAndExec(args, kw, None) File "C:\Python\Zope\Zope\lib\python\Shared\DC\Scripts\Bindings.py", line 348, in _bindAndExec return self._exec(bound_data, args, kw) File "C:\Python\Zope\Instance\Products\CMFCore\FSPythonScript.py", line 164, in _exec result = f(*args, **kw) File "Script (Python)", line 16, in standard_error_message File "C:\Python\Zope\Zope\lib\python\Shared\DC\Scripts\Bindings.py", line 311, in __call__ return self._bindAndExec(args, kw, None) File "C:\Python\Zope\Zope\lib\python\Shared\DC\Scripts\Bindings.py", line 348, in _bindAndExec return self._exec(bound_data, args, kw) File "C:\Python\Zope\Instance\Products\CMFCore\FSPageTemplate.py", line 195, in _exec result = self.pt_render(extra_context=bound_names) File "C:\Python\Zope\Instance\Products\CMFCore\FSPageTemplate.py", line 134, in pt_render result = FSPageTemplate.inheritedAttribute('pt_render')( File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\PageTemplate.py", line 104, in pt_render tal=not source, strictinsert=0)() File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 238, in __call__ self.interpret(self.program) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 281, in interpret handlers[opcode](self, args) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 749, in do_useMacro self.interpret(macro) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 281, in interpret handlers[opcode](self, args) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 457, in do_optTag_tal self.do_optTag(stuff) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 442, in do_optTag return self.no_tag(start, program) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 437, in no_tag self.interpret(program) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 281, in interpret handlers[opcode](self, args) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 749, in do_useMacro self.interpret(macro) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 281, in interpret handlers[opcode](self, args) File "C:\Python\Zope\Zope\lib\python\TAL\TALInterpreter.py", line 507, in do_setLocal_tal self.engine.setLocal(name, self.engine.evaluateValue(expr)) File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\TALES.py", line 221, in evaluate return expression(self) File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\Expressions.py", line 185, in __call__ return self._eval(econtext) File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\Expressions.py", line 180, in _eval return render(ob, econtext.vars) File "C:\Python\Zope\Zope\lib\python\Products\PageTemplates\Expressions.py", line 85, in render ob = ob() File "C:\Python\Zope\Instance\Products\CMFPlone\browser\plone.py", line 66, in globalize self._initializeData(options=options) File "C:\Python\Zope\Instance\Products\CMFPlone\browser\plone.py", line 118, in _initializeData self._data['actions'] = actions = (options.get('actions', None) or File "C:\Python\Zope\Instance\Products\CMFPlone\ActionsTool.py", line 46, in listFilteredActionsFor [self._getActions(provider_name, actions, object) \ File "C:\Python\Zope\Instance\Products\CMFPlone\ActionsTool.py", line 34, in _getActions actions.extend( provider.listActionInfos(object=object) ) File "C:\Python\Zope\Instance\Products\CMFCore\ActionProviderBase.py", line 86, in listActionInfos actions = self.listActions(object=object) File "C:\PLONE\Data\Products\CMFonFive\fiveactionstool.py", line 139, in listActions for menu_id in _listMenuIds(): File "C:\PLONE\Data\Products\CMFonFive\fiveactionstool.py", line 32, in _listMenuIds return [id for id, utility in zapi.getUtilitiesFor(IBrowserMenu)] File "C:\Python\Zope\Zope\lib\python\zope\component\__init__.py", line 263, in getUtilitiesFor return getSiteManager(context).getUtilitiesFor(interface) File "C:\PLONE\Data\Products\Five\site\localsite.py", line 142, in getUtilitiesFor File "C:\PLONE\Data\Products\Five\site\localsite.py", line 121, in utilities File "C:\Python\Zope\Zope\lib\python\zope\interface\interface.py", line 682, in __call__ raise TypeError("Could not adapt", obj, self) TypeError: ('Could not adapt', , ) From d.schulz81 at gmx.net Thu Jan 18 12:21:34 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Thu, 18 Jan 2007 12:21:34 +0100 Subject: [z3-five] Adaption of workflow tool Message-ID: <45AF583E.6090403@gmx.net> Hello Plone List, I have a database driven application that creates temporary mapped objects not intended to be persistent content types (mainly Zope 3 with Alchemist Product) That worked quite well until now, but completly without workflow. Now I would like to give workflow to these objects. (well I have to, that application depends heavily on it) As all my users and groups are mapped from LDAP inside Plone, so it would be nice to use the Plone workflow. To achieve this, I will have use some kind of persistent proxy object to store the workflow state and the reference. I looked at Zope 3 ways of doing this, means to have a persistent annotation with workflow state and IKeyReference adapter that refers to a resolvable url and the unique database key. But the bad and messy local utility and annotation support of Zope 2.9 brought me out of this track................I think zope 2.9 is not mature enough to support this. dont even know if 2.10 is. Now I found this document and have a look at the way the CPS proxy object is done, but it also relies on portal types: http://www.nuxeo.com/docs/europython2004/cps_proxies_workflows_events.pdf So my question is, has anyone done an adaption of plone workflow that does not use a portal type, but maybe a OFS.SimpleItem (that just stores the reference to the data base and workflow state) or can point me to additional material? I dont know if this solution is good style and easily possible in any way, any additional help or recommendations would be appreciated. If such an adaption is not easily possible, the fallback solution is to write my own little workflow engine, but I would weep a litte doing this. Dennis From sidnei at enfoldsystems.com Thu Jan 18 13:57:33 2007 From: sidnei at enfoldsystems.com (Sidnei da Silva) Date: Thu, 18 Jan 2007 10:57:33 -0200 Subject: [z3-five] Adaption of workflow tool In-Reply-To: <45AF583E.6090403@gmx.net> References: <45AF583E.6090403@gmx.net> Message-ID: Hi Dennis, Kapil T. send a patch to the CMF mailing list that makes the WorkflowTool use adapters to lookup the workflow and also to store the workflow information I believe. It should be possible, with that patch, to write an adapter that can even store the workflow information in your RDB. -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 From d.schulz81 at gmx.net Thu Jan 18 13:59:53 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Thu, 18 Jan 2007 13:59:53 +0100 Subject: [z3-five] Adaption of workflow tool In-Reply-To: References: <45AF583E.6090403@gmx.net> Message-ID: <45AF6F49.8090008@gmx.net> There is a product called alchemist that does integration into zope 2. it also contains an example. http://plone.org/products/alchemist I am not completely sure if it has been tested with plain zope 3 but I think it's possible too. Dennis Janko Hauser escribi?: > > Am 18.01.2007 um 12:21 schrieb Dennis Schulz: > >> I have a database driven application that creates temporary mapped >> objects not intended to be persistent content types (mainly Zope 3 with >> Alchemist Product) > > May I ask, which products you are using to connect vie sqlalchemy to > the database? Specifically how the connection pooling does work there? > I looked into zalchemy, but do not see, how connections are persisted. > > Regarding your workflow question, if you use zope-2.10 it is possible > to use hurry.workflow from Martin Faasen. > This is a simple workflowtool, which could perhaps be adapted to your > needs. > > With regards, > > __Janko Hauser > > --Janko Hauser email: jhauser at zscout.de > mobile: +49 1721 641552 > > From d.schulz81 at gmx.net Thu Jan 18 14:07:14 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Thu, 18 Jan 2007 14:07:14 +0100 Subject: [z3-five] Adaption of workflow tool In-Reply-To: References: <45AF583E.6090403@gmx.net> Message-ID: <45AF7102.3040905@gmx.net> Aha, thank you ;-) seems like Kapil is not available in these days.... may I ask how can I get this patch. I have never been on the CMS mailing list. Regards, Dennis Sidnei da Silva escribi?: > Hi Dennis, > > Kapil T. send a patch to the CMF mailing list that makes the > WorkflowTool use adapters to lookup the workflow and also to store the > workflow information I believe. It should be possible, with that > patch, to write an adapter that can even store the workflow > information in your RDB. > From sidnei at enfoldsystems.com Thu Jan 18 14:55:33 2007 From: sidnei at enfoldsystems.com (Sidnei da Silva) Date: Thu, 18 Jan 2007 11:55:33 -0200 Subject: [z3-five] Adaption of workflow tool In-Reply-To: <45AF7102.3040905@gmx.net> References: <45AF583E.6090403@gmx.net> <45AF7102.3040905@gmx.net> Message-ID: On 1/18/07, Dennis Schulz wrote: > Aha, thank you ;-) > > seems like Kapil is not available in these days.... > may I ask how can I get this patch. I have never been on the CMS mailing > list. http://www.mail-archive.com/zope-cmf at lists.zope.org/msg02995.html -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 From chris at simplistix.co.uk Sun Jan 28 12:16:31 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Sun, 28 Jan 2007 11:16:31 +0000 Subject: [z3-five] (re)using zpt macros from view page templates Message-ID: <45BC860F.9040302@simplistix.co.uk> Hi All, I have a page template that's being used for Five view. I now want to re-use part of that template as a zpt macro in another Five view. How should I go about doing this? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From lists at zopyx.com Sun Jan 28 12:43:34 2007 From: lists at zopyx.com (Andreas Jung) Date: Sun, 28 Jan 2007 12:43:34 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BC860F.9040302@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> Message-ID: <5ACA5A1F87992FAEBF789311@suxmac2.local> --On 28. Januar 2007 11:16:31 +0000 Chris Withers wrote: > Hi All, > > I have a page template that's being used for Five view. I now want to > re-use part of that template as a zpt macro in another Five view. > > How should I go about doing this? > > By registering the template with the macros as views? Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20070128/ef0dec7d/attachment.pgp From chris at simplistix.co.uk Sun Jan 28 14:30:37 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Sun, 28 Jan 2007 13:30:37 +0000 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <5ACA5A1F87992FAEBF789311@suxmac2.local> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> Message-ID: <45BCA57D.1000207@simplistix.co.uk> Andreas Jung wrote: > >> I have a page template that's being used for Five view. I now want to >> re-use part of that template as a zpt macro in another Five view. >> >> How should I go about doing this? > > By registering the template with the macros as views? Is that the canonical way? it seems pretty heavyweight in terms of instantiating a whole view, with request and all, just to get a macro... How about: my_macro.pt ----------- ...etc... ...etc... macros.py --------- from Products.Five.browser.pagetemplatefile import \ ZopeTwoPageTemplateFile my_macro = ZopeTwoPageTemplateFile('macros.pt') myview.py --------- from macros import my_macro class MyView(BrowserView): def getMacro(self): return my_macro.macros['template'] myview.pt ---------
blah
Would the above work? Is there anything wrong with it? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From lists at zopyx.com Sun Jan 28 14:41:32 2007 From: lists at zopyx.com (Andreas Jung) Date: Sun, 28 Jan 2007 14:41:32 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BCA57D.1000207@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> Message-ID: <55D50FEBB2534351B99F2D3E@suxmac2.local> --On 28. Januar 2007 13:30:37 +0000 Chris Withers wrote: > Andreas Jung wrote: >> >>> I have a page template that's being used for Five view. I now want to >>> re-use part of that template as a zpt macro in another Five view. >>> >>> How should I go about doing this? >> >> By registering the template with the macros as views? > > Is that the canonical way? it seems pretty heavyweight in terms of > instantiating a whole view, with request and all, just to get a macro... > Isn't it sufficient to register the template through ZCML? -aj -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20070128/ba3733d7/attachment.pgp From chris at simplistix.co.uk Sun Jan 28 15:34:38 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Sun, 28 Jan 2007 14:34:38 +0000 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <55D50FEBB2534351B99F2D3E@suxmac2.local> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <55D50FEBB2534351B99F2D3E@suxmac2.local> Message-ID: <45BCB47E.9030409@simplistix.co.uk> Andreas Jung wrote: > >> Is that the canonical way? it seems pretty heavyweight in terms of >> instantiating a whole view, with request and all, just to get a macro... >> > Isn't it sufficient to register the template through ZCML? Yeah, that's not what I was talking about though... If I did: myview.pt ---------
blah
...then we're looking at least at an adapter looking, probably some security checks in the traversal, and who knows what else. Is there anything wrong with just having the page template as a module-level global and importing from there? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From regebro at gmail.com Mon Jan 29 10:20:34 2007 From: regebro at gmail.com (Lennart Regebro) Date: Mon, 29 Jan 2007 10:20:34 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BCB47E.9030409@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <55D50FEBB2534351B99F2D3E@suxmac2.local> <45BCB47E.9030409@simplistix.co.uk> Message-ID: <319e029f0701290120v72d6a91fu8a3d3a17a4dc43fa@mail.gmail.com> On 1/28/07, Chris Withers wrote: > Is there anything wrong with just having the page template as a > module-level global and importing from there? Wrong? Is this a moral question? ;) Seriously though: It's hard to override, otherwise I can't see anything wrong with it, assuming it works. -- Lennart Regebro: Python, Zope, CPS, Plone consulting. +33 661 58 14 64 From maciej.wisniowski at coig.katowice.pl Mon Jan 29 10:52:00 2007 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Mon, 29 Jan 2007 10:52:00 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BCB47E.9030409@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <55D50FEBB2534351B99F2D3E@suxmac2.local> <45BCB47E.9030409@simplistix.co.uk> Message-ID: <45BDC3C0.8020202@coig.katowice.pl> > >> Isn't it sufficient to register the template through ZCML? >> > ...then we're looking at least at an adapter looking, probably some > security checks in the traversal, and who knows what else. > Even default zope skins are views that consist of other views (zope.app.basicskin.standardmacros). > Is there anything wrong with just having the page template as a > module-level global and importing from there? And what about base view like: class MyBaseView(BrowserView): my_macro = ZopeTwoPageTemplateFile('macros.pt') class MyView(MyBaseView): def getMacro(self): return self.my_macro.macros['template'] -- Maciej Wisniowski From chris at simplistix.co.uk Mon Jan 29 12:16:11 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 29 Jan 2007 11:16:11 +0000 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <319e029f0701290120v72d6a91fu8a3d3a17a4dc43fa@mail.gmail.com> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <55D50FEBB2534351B99F2D3E@suxmac2.local> <45BCB47E.9030409@simplistix.co.uk> <319e029f0701290120v72d6a91fu8a3d3a17a4dc43fa@mail.gmail.com> Message-ID: <45BDD77B.1020705@simplistix.co.uk> Lennart Regebro wrote: > Seriously though: It's hard to override, What do you mean by that? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Mon Jan 29 12:17:17 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 29 Jan 2007 11:17:17 +0000 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BDC3C0.8020202@coig.katowice.pl> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <55D50FEBB2534351B99F2D3E@suxmac2.local> <45BCB47E.9030409@simplistix.co.uk> <45BDC3C0.8020202@coig.katowice.pl> Message-ID: <45BDD7BD.2050703@simplistix.co.uk> Maciej Wisniowski wrote: >>> Isn't it sufficient to register the template through ZCML? >>> >> ...then we're looking at least at an adapter looking, probably some >> security checks in the traversal, and who knows what else. >> > Even default zope skins are views that consist > of other views (zope.app.basicskin.standardmacros). You say that like that means it's a good thing... ;-) >> Is there anything wrong with just having the page template as a >> module-level global and importing from there? > And what about base view like: > > class MyBaseView(BrowserView): > my_macro = ZopeTwoPageTemplateFile('macros.pt') > > class MyView(MyBaseView): > > def getMacro(self): > return self.my_macro.macros['template'] Yup, that's another possibility :-) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From maciej.wisniowski at coig.katowice.pl Mon Jan 29 13:00:45 2007 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Mon, 29 Jan 2007 13:00:45 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BDD7BD.2050703@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <55D50FEBB2534351B99F2D3E@suxmac2.local> <45BCB47E.9030409@simplistix.co.uk> <45BDC3C0.8020202@coig.katowice.pl> <45BDD7BD.2050703@simplistix.co.uk> Message-ID: <45BDE1ED.2090806@coig.katowice.pl> > > You say that like that means it's a good thing... ;-) In fact it was not my intention to say whether it is good or bad but in general I think that because even zope core uses this kind of macros then we may say that, at last, it is not very bad way of doing such things. But of course this depends on particular use case too. -- Maciej Wisniowski From chris at simplistix.co.uk Mon Jan 29 22:35:36 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 29 Jan 2007 21:35:36 +0000 Subject: [z3-five] Unexpectedly unprotected code Message-ID: <45BE68A8.5030403@simplistix.co.uk> Hi All, I have a view registered as follows: The view class looks like this: from Products.Five.browser import BrowserView class MyView(BrowserView): def __init__(self,context,request): self.context = context self.request = request # point A I've noticed two things about code running at point A by going to the following url: http://localhost:7001/mysite/anobject/@@myview 1. Code running at this point has no security context, so anything that uses getSecurityManager will get an anonymous user. This is annoying. Why is it like this? 2. More worrying, the code running at point A is "trusted". Am I being unreasonable to expect that code only to run if the current user has cmf.ModifyPortalContent? The first implementation of this view did it's form processing in the __init__ method. Because of point 2, that meant that any anonymous user could edit objects they shouldn't have been able to. The code needed a user object though, so thanks to point 1, it always did the wrong thing, so even legitimate users ended up screwed ;-) Can anyone explain a bit more about this and how you're supposed to get around this? Cheers, Chris From sidnei at enfoldsystems.com Mon Jan 29 22:57:02 2007 From: sidnei at enfoldsystems.com (Sidnei da Silva) Date: Mon, 29 Jan 2007 15:57:02 -0600 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45BE68A8.5030403@simplistix.co.uk> References: <45BE68A8.5030403@simplistix.co.uk> Message-ID: On 1/29/07, Chris Withers wrote: > 1. Code running at this point has no security context, so anything that > uses getSecurityManager will get an anonymous user. This is annoying. > Why is it like this? It's because the traversal machinery needs to get the final object to be published to find the innermost acl_users object, to validate the possibly local user. So what happens is that the validate() method of the security machinery is only called after the traversal finds the last object in the chain. Your __init__ method is called right before that, during traversal, while *creating* the view object, which most likely will be the last object in the chain. > 2. More worrying, the code running at point A is "trusted". Am I being > unreasonable to expect that code only to run if the current user has > cmf.ModifyPortalContent? Yes you are? :) > Can anyone explain a bit more about this and how you're supposed to get > around this? By implementing your stuff into a proper method of the view class that gets called *after* the traversal has taken place, and not in the 'constructor'. -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 From optilude at gmx.net Mon Jan 29 22:57:49 2007 From: optilude at gmx.net (Martin Aspeli) Date: Mon, 29 Jan 2007 21:57:49 +0000 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45BE68A8.5030403@simplistix.co.uk> References: <45BE68A8.5030403@simplistix.co.uk> Message-ID: Chris Withers wrote: > class MyView(BrowserView): > > def __init__(self,context,request): > self.context = context > self.request = request > # point A > > > I've noticed two things about code running at point A by going to the > following url: > > http://localhost:7001/mysite/anobject/@@myview > > 1. Code running at this point has no security context, so anything that > uses getSecurityManager will get an anonymous user. This is annoying. > Why is it like this? Because you're in __init__(). Try the same thing in a content object, you won't have one there either. > 2. More worrying, the code running at point A is "trusted". Am I being > unreasonable to expect that code only to run if the current user has > cmf.ModifyPortalContent? All code inside views is trusted. It's not TTW code, so I think that's reasonable. This is Zope 2, remember, so security proxies start at the TTW/filesystem boundary. > The first implementation of this view did it's form processing in the > __init__ method. Because of point 2, that meant that any anonymous user > could edit objects they shouldn't have been able to. That doesn't sound sensible... The anonymous user shouldn't be allowed to instantiate the view at all, because it's protected by permission="cmf.ModifyPortalContent". At least that's my understanding. It may be that __init__() gets called first, though... In any case, form processing in __init__() is not very pretty, I think it makes much more sense to do that in __call__(). > Can anyone explain a bit more about this and how you're supposed to get > around this? Put code in __call__(). Don't use 'template' in ZCML, but instead do from Products.Five.browser import BrowserView from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile class Foo(BrowserView): template = ViewPageTemplateFile('myview.pt') def __call__(self): # process from self.context and self.request return self.template() Martin From philipp at weitershausen.de Mon Jan 29 23:40:08 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Mon, 29 Jan 2007 23:40:08 +0100 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45BE68A8.5030403@simplistix.co.uk> References: <45BE68A8.5030403@simplistix.co.uk> Message-ID: <45BE77C8.1030909@weitershausen.de> Chris Withers wrote: > 1. Code running at this point has no security context, so anything that > uses getSecurityManager will get an anonymous user. This is annoying. > Why is it like this? Sidnei already said it: it's traversal, there's no security context determined yet. > 2. More worrying, the code running at point A is "trusted". Am I being > unreasonable to expect that code only to run if the current user has > cmf.ModifyPortalContent? No, you're simply not getting the difference between __init__ and a __call__ on a view :). > The first implementation of this view did it's form processing in the > __init__ method. That's typically not considered good style. As Sidnei said already, the __init__ of a view is invoked when the view is looked up. That happens during traversal. There's no certainty that the view will be the last thing in the traversal chain or that the view will actually end up being called. For example, the view might not be accessible to the current user due to insufficient privileges. Therefore doing stuff in __init__ that changes the state of the app is asking for trouble. > Because of point 2, that meant that any anonymous user > could edit objects they shouldn't have been able to. The code needed a > user object though, so thanks to point 1, it always did the wrong thing, > so even legitimate users ended up screwed ;-) > > Can anyone explain a bit more about this and how you're supposed to get > around this? Actual view code belongs in __call__. -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From philipp at weitershausen.de Mon Jan 29 23:45:31 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Mon, 29 Jan 2007 23:45:31 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BCA57D.1000207@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> Message-ID: <45BE790B.5080302@weitershausen.de> Chris Withers wrote: > Andreas Jung wrote: >>> I have a page template that's being used for Five view. I now want to >>> re-use part of that template as a zpt macro in another Five view. >>> >>> How should I go about doing this? >> By registering the template with the macros as views? > > Is that the canonical way? it seems pretty heavyweight in terms of > instantiating a whole view, with request and all, just to get a macro... > > How about: > > my_macro.pt > ----------- > > ...etc... > > ...etc... > > myview.pt > --------- > use-macro="context/@@mymacro/template" >
> blah >
> > > Would the above work? Why dontcha try it out?!? Anyway, it looks like lots of unnecessary typing. Just register the tempalte with the macro as a page and access the macro as outlined above. -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From chris at simplistix.co.uk Mon Jan 29 23:55:06 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 29 Jan 2007 22:55:06 +0000 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BE790B.5080302@weitershausen.de> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <45BE790B.5080302@weitershausen.de> Message-ID: <45BE7B4A.4060601@simplistix.co.uk> Philipp von Weitershausen wrote: >> my_macro.pt >> ----------- >> >> ...etc... >> >> ...etc... >> > > Okay, but what interface do I bind it to? *, so it's available on all objects? It just seems a bit wasteful, a view is essentially a multiadapter for a context and a request. A macro needs neither context nor request, and feels a lot close to a utility to me. I want to get it from one define place, but only be accessible either from trusted code, or by people who are allowed to view it. > Anyway, it looks like lots of unnecessary typing. Just register the > tempalte with the macro as a page and access the macro as outlined above. Well, my way wasn't much typing, but I hit a problem. seems to have a TAL version of 1.5. Products.Five.browser.pagetemplatefile.ViewPageTemplateFile seems to instantiate templates with a TAL version of 1.6. So, if I try and use my macro from a normal Five view, I get a METALError: macro 'mymacro' has incompatible version '1.6'. Why is that? How can I fix it and get them both to use the same TAL version? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Mon Jan 29 23:57:03 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 29 Jan 2007 22:57:03 +0000 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: References: <45BE68A8.5030403@simplistix.co.uk> Message-ID: <45BE7BBF.7060805@simplistix.co.uk> Martin Aspeli wrote: >> The first implementation of this view did it's form processing in the >> __init__ method. > > That doesn't sound sensible... Indeed, that's why I moved it to its own method. That method still seems to need a doctstring to placate Zope 2's publisher, but am I right in thinking that method is protected by the view's permissions? > The anonymous user shouldn't be allowed > to instantiate the view at all, because it's protected by > permission="cmf.ModifyPortalContent". Yes, I think this is the bit that surprised me. Why can an anonymous user cause a view they have no rights to see to be instantiated? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Mon Jan 29 23:59:55 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Mon, 29 Jan 2007 23:59:55 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BE7B4A.4060601@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <45BE790B.5080302@weitershausen.de> <45BE7B4A.4060601@simplistix.co.uk> Message-ID: <84F4CD03-7C18-4B6D-AF17-029FFDAB1777@weitershausen.de> On 29 Jan 2007, at 23:55 , Chris Withers wrote: > Philipp von Weitershausen wrote: >>> my_macro.pt >>> ----------- >>> >>> ...etc... >>> >>> ...etc... >>> >> > > Okay, but what interface do I bind it to? *, so it's available on > all objects? It just seems a bit wasteful, a view is essentially a > multiadapter for a context and a request. A macro needs neither > context nor request, and feels a lot close to a utility to me. It's not always about actually *using* context or request. These two can also serve as keys for the lookup. The skin is expressed as a marker interface on the request, so for different skins you could have different versions of the 'mymacro' view, hence different macros for your templates. > I want to get it from one define place, but only be accessible > either from trusted code, or by people who are allowed to view it. You don't have to do it the way I outlined it... >> Anyway, it looks like lots of unnecessary typing. Just register >> the tempalte with the macro as a page and access the macro as >> outlined above. > > Well, my way wasn't much typing, but I hit a problem. > > seems to > have a TAL version of 1.5. > > Products.Five.browser.pagetemplatefile.ViewPageTemplateFile seems > to instantiate templates with a TAL version of 1.6. That's hard to believe. Couldn't it be you're confusing Zope3's *zope.app.pagetemplate*.ViewPageTemplateFile with Five's one? > So, if I try and use my macro from a normal Five view, I get a > METALError: macro 'mymacro' has incompatible version '1.6'. > > Why is that? How can I fix it and get them both to use the same TAL > version? Use everything from Five. It works. From sidnei at enfoldsystems.com Tue Jan 30 00:02:20 2007 From: sidnei at enfoldsystems.com (Sidnei da Silva) Date: Mon, 29 Jan 2007 17:02:20 -0600 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45BE7BBF.7060805@simplistix.co.uk> References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> Message-ID: On 1/29/07, Chris Withers wrote: > Why can an anonymous user cause a view they have no rights to see to be > instantiated? I guess that because you need acquisition context to check rights, and you need an instance to have acquisition context. -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 From philipp at weitershausen.de Tue Jan 30 00:06:16 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 30 Jan 2007 00:06:16 +0100 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> Message-ID: <45BE7DE8.7000706@weitershausen.de> Sidnei da Silva wrote: > On 1/29/07, Chris Withers wrote: >> Why can an anonymous user cause a view they have no rights to see to be >> instantiated? > > I guess that because you need acquisition context to check rights, and > you need an instance to have acquisition context. Absolutely correct. -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From chris at simplistix.co.uk Tue Jan 30 08:50:00 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 30 Jan 2007 07:50:00 +0000 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45BE7DE8.7000706@weitershausen.de> References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> Message-ID: <45BEF8A8.8040806@simplistix.co.uk> Philipp von Weitershausen wrote: > Sidnei da Silva wrote: >> On 1/29/07, Chris Withers wrote: >>> Why can an anonymous user cause a view they have no rights to see to be >>> instantiated? >> >> I guess that because you need acquisition context to check rights, and >> you need an instance to have acquisition context. > > Absolutely correct. Am I right in thinking Zope 3's security machinery doesn't have this problem? Are there any plans to move Zope 2 to Zope 3's security machinery? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Tue Jan 30 09:44:57 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 30 Jan 2007 08:44:57 +0000 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <84F4CD03-7C18-4B6D-AF17-029FFDAB1777@weitershausen.de> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <45BE790B.5080302@weitershausen.de> <45BE7B4A.4060601@simplistix.co.uk> <84F4CD03-7C18-4B6D-AF17-029FFDAB1777@weitershausen.de> Message-ID: <45BF0589.1040406@simplistix.co.uk> Philipp von Weitershausen wrote: > It's not always about actually *using* context or request. These two can > also serve as keys for the lookup. The skin is expressed as a marker > interface on the request, so for different skins you could have > different versions of the 'mymacro' view, hence different macros for > your templates. Can you give me an example of how this would work or where I can look to see real code? It sounds like a reasonable use case, but I can't quite get my head around it... >> Well, my way wasn't much typing, but I hit a problem. >> >> seems to >> have a TAL version of 1.5. >> >> Products.Five.browser.pagetemplatefile.ViewPageTemplateFile seems to >> instantiate templates with a TAL version of 1.6. > > That's hard to believe. Couldn't it be you're confusing Zope3's > *zope.app.pagetemplate*.ViewPageTemplateFile with Five's one? Please find attached a minimal example. I'm using Zope 2.9.4 and all the files were in lib/python of the instance. The zcml file was included with the following in site.zcml: Any help greatfully received! cheers, Chris PS: Putting this together, I noticed another thing... am I right in thinking that: ...doesn't work? As you'll see in the minimal example, I had to bind to OFS.Folder.Folder instead and then create a dummy folder so I could test the view in a browser. -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: view.zcml Url: http://codespeak.net/pipermail/z3-five/attachments/20070130/bcc03061/attachment.diff -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20070130/bcc03061/attachment.htm -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20070130/bcc03061/attachment-0001.htm -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test.py Url: http://codespeak.net/pipermail/z3-five/attachments/20070130/bcc03061/attachment-0001.diff From chris at simplistix.co.uk Tue Jan 30 13:05:57 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 30 Jan 2007 12:05:57 +0000 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BF0589.1040406@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <45BE790B.5080302@weitershausen.de> <45BE7B4A.4060601@simplistix.co.uk> <84F4CD03-7C18-4B6D-AF17-029FFDAB1777@weitershausen.de> <45BF0589.1040406@simplistix.co.uk> Message-ID: <45BF34A5.8090005@simplistix.co.uk> Chris Withers wrote: > Any help greatfully received! > from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile This was my mistake, that should have been: from Products.Five.browser.pagetemplatefile import \ ZopeTwoPageTemplateFile However, now using the right class... my_macro = ZopeTwoPageTemplateFile('my_macro.pt') my_macro.macros just gives me a ComputedAttribute object (rather than the macros I'd expect). If I do, my_macro.pt_macros(), I get the macros. Why isn't ComputedAttribute working in this example? cheers, Chris PS: Still interested in this too: > PS: Putting this together, I noticed another thing... am I right in > thinking that: > > > > ...doesn't work? As you'll see in the minimal example, I had to bind to > OFS.Folder.Folder instead and then create a dummy folder so I could test > the view in a browser. -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Tue Jan 30 14:35:31 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 30 Jan 2007 14:35:31 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BF34A5.8090005@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <45BE790B.5080302@weitershausen.de> <45BE7B4A.4060601@simplistix.co.uk> <84F4CD03-7C18-4B6D-AF17-029FFDAB1777@weitershausen.de> <45BF0589.1040406@simplistix.co.uk> <45BF34A5.8090005@simplistix.co.uk> Message-ID: <45BF49A3.70101@weitershausen.de> Chris Withers wrote: > Chris Withers wrote: > >> Any help greatfully received! > >> from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile > > This was my mistake, that should have been: > > from Products.Five.browser.pagetemplatefile import \ > ZopeTwoPageTemplateFile They're the same. It shouldn't make a difference. > However, now using the right class... > > my_macro = ZopeTwoPageTemplateFile('my_macro.pt') > > my_macro.macros just gives me a ComputedAttribute object (rather than > the macros I'd expect). > > If I do, my_macro.pt_macros(), I get the macros. > > Why isn't ComputedAttribute working in this example? Coz ComputedAttribute is a stupid Zope2ism that only works in an acquisition context. I still think you're overcomplicating things. You don't really need any python code. Just register your macro template as a browser:page and then access the macro in the other template via context/@@viewname_of_the_macrotemplate/macroname. I've spelt this out already, it's your choice to do it or not. I won't give any predictions on what else might work or not since this is the standard way of accessing macros... -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From philipp at weitershausen.de Tue Jan 30 15:12:28 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 30 Jan 2007 15:12:28 +0100 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45BEF8A8.8040806@simplistix.co.uk> References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> Message-ID: On 30 Jan 2007, at 08:50 , Chris Withers wrote: > Philipp von Weitershausen wrote: >> Sidnei da Silva wrote: >>> On 1/29/07, Chris Withers wrote: >>>> Why can an anonymous user cause a view they have no rights to >>>> see to be >>>> instantiated? >>> >>> I guess that because you need acquisition context to check >>> rights, and >>> you need an instance to have acquisition context. >> Absolutely correct. > > Am I right in thinking Zope 3's security machinery doesn't have > this problem? Zope 3's security machinery certainly can't work around the fact that you first have to instantiate an adapter (=view) before you can make security assertions on it. In Zope3, therefore, app code doesn't belong in a view's __init__ either. As for having acquisition contexts, the default security policy in Zope 3 wants views to have __parent__ so that it can acquire security information. This decision isn't part of the security machinery of Zope3, it's a policy choice. > Are there any plans to move Zope 2 to Zope 3's security machinery? Jim has remote plans and Martijn has some wild ideas. I don't see it happening any time soon, though. It's also not the issue here. From regebro at gmail.com Tue Jan 30 15:24:13 2007 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 30 Jan 2007 15:24:13 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BDD77B.1020705@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <55D50FEBB2534351B99F2D3E@suxmac2.local> <45BCB47E.9030409@simplistix.co.uk> <319e029f0701290120v72d6a91fu8a3d3a17a4dc43fa@mail.gmail.com> <45BDD77B.1020705@simplistix.co.uk> Message-ID: <319e029f0701300624p78de8c99hff28d6d5115a12cf@mail.gmail.com> On 1/29/07, Chris Withers wrote: > Lennart Regebro wrote: > > Seriously though: It's hard to override, > > What do you mean by that? What I mean is that if you want to override that macro in another product, for say a customer site, you will have to monkey-patch it. If you instead register the macro so it becomes a view, it's easy to override. -- Lennart Regebro: Python, Zope, CPS, Plone consulting. +33 661 58 14 64 From rocky at serverzen.com Tue Jan 30 15:54:14 2007 From: rocky at serverzen.com (Rocky Burt) Date: Tue, 30 Jan 2007 11:24:14 -0330 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <319e029f0701300624p78de8c99hff28d6d5115a12cf@mail.gmail.com> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <55D50FEBB2534351B99F2D3E@suxmac2.local> <45BCB47E.9030409@simplistix.co.uk> <319e029f0701290120v72d6a91fu8a3d3a17a4dc43fa@mail.gmail.com> <45BDD77B.1020705@simplistix.co.uk> <319e029f0701300624p78de8c99hff28d6d5115a12cf@mail.gmail.com> Message-ID: <1170168849.7670.41.camel@localhost> On Tue, 2007-30-01 at 15:24 +0100, Lennart Regebro wrote: > On 1/29/07, Chris Withers wrote: > > Lennart Regebro wrote: > > > Seriously though: It's hard to override, > > > > What do you mean by that? > > What I mean is that if you want to override that macro in another > product, for say a customer site, you will have to monkey-patch it. If > you instead register the macro so it becomes a view, it's easy to > override. Right, by specifying an override either in overrides.zcml (zope >= 2.8) or providing a local adapter (zope >= 2.10). - Rocky -- Rocky Burt ServerZen Software -- http://www.serverzen.com News About The Server (blog) -- http://www.serverzen.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20070130/1c4762ce/attachment-0001.pgp From philipp at weitershausen.de Tue Jan 30 16:19:58 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 30 Jan 2007 16:19:58 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <1170168849.7670.41.camel@localhost> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <55D50FEBB2534351B99F2D3E@suxmac2.local> <45BCB47E.9030409@simplistix.co.uk> <319e029f0701290120v72d6a91fu8a3d3a17a4dc43fa@mail.gmail.com> <45BDD77B.1020705@simplistix.co.uk> <319e029f0701300624p78de8c99hff28d6d5115a12cf@mail.gmail.com> <1170168849.7670.41.camel@localhost> Message-ID: <45BF621E.2090101@weitershausen.de> Rocky Burt wrote: > On Tue, 2007-30-01 at 15:24 +0100, Lennart Regebro wrote: >> On 1/29/07, Chris Withers wrote: >>> Lennart Regebro wrote: >>>> Seriously though: It's hard to override, >>> What do you mean by that? >> What I mean is that if you want to override that macro in another >> product, for say a customer site, you will have to monkey-patch it. If >> you instead register the macro so it becomes a view, it's easy to >> override. > > Right, by specifying an override either in overrides.zcml (zope >= 2.8) > or providing a local adapter (zope >= 2.10). Actually, the way we typically override views, especially the ones that are about the appearance of the app, is through layers and skins. -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From faassen at startifact.com Tue Jan 30 18:32:39 2007 From: faassen at startifact.com (Martijn Faassen) Date: Tue, 30 Jan 2007 18:32:39 +0100 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> Message-ID: Philipp von Weitershausen wrote: > On 30 Jan 2007, at 08:50 , Chris Withers wrote: >> Are there any plans to move Zope 2 to Zope 3's security machinery? > > Jim has remote plans and Martijn has some wild ideas. I don't see it > happening any time soon, though. It's also not the issue here. And you have some other ideas to make the Zope 2 security model more Zope 3 compatible so it can look at __parent__. My ideas have evolved to the point that I like trusted code more and more, and I'm not sure it's worth the effort to expend a lot of time to make untrusted code work. Regards, Martijn From chris at simplistix.co.uk Tue Jan 30 19:55:26 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 30 Jan 2007 18:55:26 +0000 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BF49A3.70101@weitershausen.de> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <45BE790B.5080302@weitershausen.de> <45BE7B4A.4060601@simplistix.co.uk> <84F4CD03-7C18-4B6D-AF17-029FFDAB1777@weitershausen.de> <45BF0589.1040406@simplistix.co.uk> <45BF34A5.8090005@simplistix.co.uk> <45BF49A3.70101@weitershausen.de> Message-ID: <45BF949E.8060204@simplistix.co.uk> Philipp von Weitershausen wrote: >>> from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile >> >> This was my mistake, that should have been: >> >> from Products.Five.browser.pagetemplatefile import \ >> ZopeTwoPageTemplateFile > > They're the same. It shouldn't make a difference. No, they're not... Products.Five.browser.pagetemplatefile import ViewPageTemplateFile ...just imports ViewPageTemplateFile from there, it's origin, if you read pagetemplatefile.py is: from zope.app.pagetemplate.viewpagetemplatefile import \ ViewPageTemplateFile ...and it appears to be a total red herring, since it's not actually used anywhere inside pagetemplatefile.py :-( Maybe it could get removed? >> However, now using the right class... >> >> my_macro = ZopeTwoPageTemplateFile('my_macro.pt') >> >> my_macro.macros just gives me a ComputedAttribute object (rather than >> the macros I'd expect). >> >> If I do, my_macro.pt_macros(), I get the macros. >> >> Why isn't ComputedAttribute working in this example? > > Coz ComputedAttribute is a stupid Zope2ism that only works in an > acquisition context. Yup, I got that after much nashing... > I still think you're overcomplicating things. Indeed, here's what I've ended up with, which I think is just fine... mymacro.pt ---------- ... macros.py --------- from Products.Five.browser.pagetemplatefile import \ ZopeTwoPageTemplateFile mymacro = ZopeTwoPageTemplateFile('mymacro.pt') myview.py --------- from macros import mymacro class MyView(BrowserView): mymacro = mymacro myview.pt: ... I find this much more lightweight, not to mention secure, than registering a full blown browser page just for some macros... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Tue Jan 30 20:02:50 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 30 Jan 2007 20:02:50 +0100 Subject: [z3-five] (re)using zpt macros from view page templates In-Reply-To: <45BF949E.8060204@simplistix.co.uk> References: <45BC860F.9040302@simplistix.co.uk> <5ACA5A1F87992FAEBF789311@suxmac2.local> <45BCA57D.1000207@simplistix.co.uk> <45BE790B.5080302@weitershausen.de> <45BE7B4A.4060601@simplistix.co.uk> <84F4CD03-7C18-4B6D-AF17-029FFDAB1777@weitershausen.de> <45BF0589.1040406@simplistix.co.uk> <45BF34A5.8090005@simplistix.co.uk> <45BF49A3.70101@weitershausen.de> <45BF949E.8060204@simplistix.co.uk> Message-ID: On 30 Jan 2007, at 19:55 , Chris Withers wrote: > Philipp von Weitershausen wrote: >>>> from Products.Five.browser.pagetemplatefile import >>>> ViewPageTemplateFile >>> >>> This was my mistake, that should have been: >>> >>> from Products.Five.browser.pagetemplatefile import \ >>> ZopeTwoPageTemplateFile >> They're the same. It shouldn't make a difference. > > No, they're not... > > Products.Five.browser.pagetemplatefile import ViewPageTemplateFile > > ...just imports ViewPageTemplateFile from there, it's origin, if > you read pagetemplatefile.py is: > > from zope.app.pagetemplate.viewpagetemplatefile import \ > ViewPageTemplateFile > > ...and it appears to be a total red herring, since it's not > actually used anywhere inside pagetemplatefile.py :-( Aaah. In more recent Five versions, I aliased ZopeTwoPageTemplateFile (what a stupid name) to ViewPageTemplateFile. > Maybe it could get removed? Aaah, yes, the unused import should be removed. From d.schulz81 at gmx.net Wed Jan 31 11:19:15 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Wed, 31 Jan 2007 11:19:15 +0100 Subject: [z3-five] using getToolByName in utility Message-ID: <45C06D23.8040103@gmx.net> Hello... I made an utility (vocabulary factory) that returns all users. It queries the membership tool. (see code at the end) That works fine for displaying it as a dropdown in a formlib form. However, when change a value and submit the form, the utility gets called in a weird context by the formlib validation machinery. When I print out aq_chain then I only have one object without base request. Within this weird context the getToolByName loopup is not possible. Is there any workaround except trying to skip validation (how?)? Dennis class UserVocabulary(object): implements(IVocabularyFactory) def __call__(self, context): context = getattr(context, 'context', context) context = aq_inner(context) print aq_chain(context) mt = getToolByName(context, 'portal_membership') memberids = mt.listMemberIds() result=[( mt.getMemberById(i).getProperty('fullname'),i) for i in memberids] return SimpleVocabulary.fromItems(result) UserVocabularyFactory = UserVocabulary() From chris at simplistix.co.uk Wed Jan 31 11:15:34 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 31 Jan 2007 10:15:34 +0000 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> Message-ID: <45C06C46.8040103@simplistix.co.uk> Martijn Faassen wrote: > My ideas have evolved to the point that I like trusted code more and > more, and I'm not sure it's worth the effort to expend a lot of time to > make untrusted code work. Oh I dunno, I think this an exceptionally important use case which the Zope community seems to be ignoring more and more and which used to be the main thing that brought people to Zope: the ability for a trusted but not necessarily fully competent user to write code while protecting them from accessing data they shouldn't and trying to help them not shoot themselves in the foot... I think that's still well worth doing... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From y.2007- at wcm-solutions.de Wed Jan 31 13:19:50 2007 From: y.2007- at wcm-solutions.de (yuppie) Date: Wed, 31 Jan 2007 13:19:50 +0100 Subject: [z3-five] using getToolByName in utility In-Reply-To: <45C06D23.8040103@gmx.net> References: <45C06D23.8040103@gmx.net> Message-ID: <45C08966.9060905@wcm-solutions.de> Hi Dennis! Dennis Schulz wrote: > I made an utility (vocabulary factory) that returns all users. It > queries the membership tool. (see code at the end) > That works fine for displaying it as a dropdown in a formlib form. > However, when change a value and submit the form, the utility gets > called in a weird context by the formlib validation machinery. > When I print out aq_chain then I only have one object without base request. > Within this weird context the getToolByName loopup is not possible. IIRC the validation machinery uses the context bound to the field. Something seems to be wrong with the bind() call. > class UserVocabulary(object): > implements(IVocabularyFactory) > def __call__(self, context): What is context and aq_chain(context) here? > context = getattr(context, 'context', context) And what here? > context = aq_inner(context) > print aq_chain(context) > mt = getToolByName(context, 'portal_membership') > memberids = mt.listMemberIds() > result=[( mt.getMemberById(i).getProperty('fullname'),i) for > i in memberids] > return SimpleVocabulary.fromItems(result) > UserVocabularyFactory = UserVocabulary() HTH, Yuppie From d.schulz81 at gmx.net Wed Jan 31 14:56:29 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Wed, 31 Jan 2007 14:56:29 +0100 Subject: [z3-five] using getToolByName in utility In-Reply-To: <45C08966.9060905@wcm-solutions.de> References: <45C06D23.8040103@gmx.net> <45C08966.9060905@wcm-solutions.de> Message-ID: <45C0A00D.3010608@gmx.net> **Hello Yuppie,** **No matter where I print context (all places that you suggested) , aq_base(context) it is always the same, only my object without acquisition chain:** [] I am using the applychanges of alchemist and the alchmist bind method. Could this be the reason? Here is the applychanges def applyChanges(context, form_fields, data, adapters=None): """ the default applyChanges from formlib, doesn't play nice with subobjects unless a new object is created on edit, we want to edit the value in place so to detect value changes on subobject changes we manually introspect the state of the mapped object to detect changes. """ if adapters is None: adapters = {} changed = False for form_field in form_fields: field = form_field.field # Adapt context, if necessary interface = field.interface adapter = adapters.get(interface) if adapter is None: if interface is None: adapter = context else: adapter = interface(context) adapters[interface] = adapter name = form_field.__name__ newvalue = data.get(name, form_field) # using form_field as marker if IObject.providedBy( field ) and ITableSchema.providedBy( newvalue ): # we expunge objects from session, to prevent spurious db changes on caught # form exceptions. if we get to the application of form data, then we passed # through validation, and values should be reattached to the session, for # persistence. if not attribute_manager.is_modified( newvalue ): continue newvalue = aq_base( newvalue ) session_id = getattr( newvalue, '_sa_session_id', None) if session_id is None: session = get_session() if getattr( newvalue, '_instance_key', None): session._attach( newvalue ) # this doesn't work as well we would expect, it resets state on updates # session.save_or_update( newvalue ) assert newvalue in session.dirty changed = True continue # else its new session.save( newvalue ) changed = True if (newvalue is not form_field) and (field.get(adapter) != newvalue): changed = True field.set(adapter, newvalue) return changed **** ** ** ** ** **Here the exception I get:** **ConstraintNotSatisfied** Sorry, a site error occurred. Traceback (innermost last): * Module ZPublisher.Publish, line 196, in publish_module_standard * Module Products.PlacelessTranslationService.PatchStringIO, line 34, in new_publish * Module ZPublisher.Publish, line 146, in publish * Module Zope2.App.startup, line 222, in zpublisher_exception_hook * Module ZPublisher.Publish, line 115, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 41, in call_object * Module zope.formlib.form, line 757, in __call__ * Module Products.PurchaseRequisition.browser.CELLSformlib, line 571, in update * Module Products.Five.formlib.formbase, line 54, in update * Module zope.formlib.form, line 738, in update * Module zope.formlib.form, line 582, in success * Module Products.PurchaseRequisition.browser.CELLSformlib, line 458, in handle_save_action * Module Products.PurchaseRequisition.browser.CELLSformlib, line 1021, in applyChanges * Module zope.schema._bootstrapfields, line 183, in set * Module ore.alchemist.bind, line 53, in __set__ * Module zope.schema._bootstrapfields, line 138, in validate * Module zope.schema._field, line 271, in _validate ConstraintNotSatisfied: klora (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: 'str' object has no attribute 'args') yuppie escribi?: > Hi Dennis! > > > Dennis Schulz wrote: > >> I made an utility (vocabulary factory) that returns all users. It >> queries the membership tool. (see code at the end) >> That works fine for displaying it as a dropdown in a formlib form. >> However, when change a value and submit the form, the utility gets >> called in a weird context by the formlib validation machinery. >> When I print out aq_chain then I only have one object without base request. >> Within this weird context the getToolByName loopup is not possible. >> > > IIRC the validation machinery uses the context bound to the field. > Something seems to be wrong with the bind() call. > > >> class UserVocabulary(object): >> implements(IVocabularyFactory) >> def __call__(self, context): >> > > What is context and aq_chain(context) here? > > >> context = getattr(context, 'context', context) >> > > And what here? > > >> context = aq_inner(context) >> print aq_chain(context) >> mt = getToolByName(context, 'portal_membership') >> memberids = mt.listMemberIds() >> result=[( mt.getMemberById(i).getProperty('fullname'),i) for >> i in memberids] >> return SimpleVocabulary.fromItems(result) >> UserVocabularyFactory = UserVocabulary() >> > > > HTH, > > Yuppie > > _______________________________________________ > z3-five mailing list > z3-five at codespeak.net > http://codespeak.net/mailman/listinfo/z3-five > > > From y.2007- at wcm-solutions.de Wed Jan 31 15:33:48 2007 From: y.2007- at wcm-solutions.de (yuppie) Date: Wed, 31 Jan 2007 15:33:48 +0100 Subject: [z3-five] using getToolByName in utility In-Reply-To: <45C0A00D.3010608@gmx.net> References: <45C06D23.8040103@gmx.net> <45C08966.9060905@wcm-solutions.de> <45C0A00D.3010608@gmx.net> Message-ID: <45C0A8CC.8010508@wcm-solutions.de> Dennis Schulz wrote: > **No matter where I print context (all places that you suggested) , > aq_base(context) it is always the same, only my object without > acquisition chain:** > > > [] > > > I am using the applychanges of alchemist and the alchmist bind method. > Could this be the reason? > * Module ore.alchemist.bind, line 53, in __set__ __set__() is called with your object as argument. You have to figure out why that object is not acquisition wrapped. AFAICS your code only works if your object is wrapped in that place. HTH, Yuppie From d.schulz81 at gmx.net Wed Jan 31 17:12:03 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Wed, 31 Jan 2007 17:12:03 +0100 Subject: [z3-five] using getToolByName in utility In-Reply-To: <45C0A8CC.8010508@wcm-solutions.de> References: <45C06D23.8040103@gmx.net> <45C08966.9060905@wcm-solutions.de> <45C0A00D.3010608@gmx.net> <45C0A8CC.8010508@wcm-solutions.de> Message-ID: <45C0BFD3.6060801@gmx.net> In the applychanges the object is still wrapped into acquisition correctly. and gets passed to field.set(adapter,newvalue) with the right context. In the set of the field the aq chain is ok as well it calls then setattr(object, self.__name__, value) now the set of the alchemist ValidatedProperty is invoked. in the set method there the aq_chain is destroyed. I dont know why the set is called without acquisition context. So you see any way to change something here? Dennis yuppie escribi?: > Dennis Schulz wrote: >> **No matter where I print context (all places that you suggested) , >> aq_base(context) it is always the same, only my object without >> acquisition chain:** >> >> >> [] >> >> >> I am using the applychanges of alchemist and the alchmist bind method. >> Could this be the reason? > >> * Module ore.alchemist.bind, line 53, in __set__ > > __set__() is called with your object as argument. You have to figure > out why that object is not acquisition wrapped. AFAICS your code only > works if your object is wrapped in that place. > > HTH, Yuppie > > From faassen at startifact.com Wed Jan 31 17:12:54 2007 From: faassen at startifact.com (Martijn Faassen) Date: Wed, 31 Jan 2007 17:12:54 +0100 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45C06C46.8040103@simplistix.co.uk> References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> <45C06C46.8040103@simplistix.co.uk> Message-ID: Chris Withers wrote: > Martijn Faassen wrote: >> My ideas have evolved to the point that I like trusted code more and >> more, and I'm not sure it's worth the effort to expend a lot of time to >> make untrusted code work. > > Oh I dunno, I think this an exceptionally important use case which the > Zope community seems to be ignoring more and more and which used to be > the main thing that brought people to Zope: the ability for a trusted > but not necessarily fully competent user to write code while protecting > them from accessing data they shouldn't and trying to help them not > shoot themselves in the foot... > > I think that's still well worth doing... I agree the use case exists. I'm not sure how important it is, though traditionally it's been quite important to Zope 2. I think there are a lot of *other* things we should be doing first to make an inexperienced developer happier with Zope 3. Some of those things we've been trying to do with Grok. One of the things that bugs me even as an *experienced* developer is that Zope 3's pervasive security has a heavy cost during development. It happened to me quite frequently I had to debug why Zope 3 didn't let me do something I should do, and I had to dig through ZCML files and add security declarations quite often, and mess about with __parent__ quite often, and use removeAllSecurityProxies() and such quite often. I consider this very off-putting to any developer, experienced or not. Regards, Martijn From chrism at plope.com Wed Jan 31 17:37:14 2007 From: chrism at plope.com (Chris McDonough) Date: Wed, 31 Jan 2007 11:37:14 -0500 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> <45C06C46.8040103@simplistix.co.uk> Message-ID: <911BAE4F-6AF2-4D15-A0CE-5C3EF8CFDCBD@plope.com> As always, a big +1 to anything that helps experienced developers not need to care about unstrusted code. - C On Jan 31, 2007, at 11:12 AM, Martijn Faassen wrote: > Chris Withers wrote: >> Martijn Faassen wrote: >>> My ideas have evolved to the point that I like trusted code more and >>> more, and I'm not sure it's worth the effort to expend a lot of >>> time to >>> make untrusted code work. >> >> Oh I dunno, I think this an exceptionally important use case which >> the >> Zope community seems to be ignoring more and more and which used >> to be >> the main thing that brought people to Zope: the ability for a trusted >> but not necessarily fully competent user to write code while >> protecting >> them from accessing data they shouldn't and trying to help them not >> shoot themselves in the foot... >> >> I think that's still well worth doing... > > I agree the use case exists. I'm not sure how important it is, though > traditionally it's been quite important to Zope 2. > > I think there are a lot of *other* things we should be doing first to > make an inexperienced developer happier with Zope 3. Some of those > things we've been trying to do with Grok. > > One of the things that bugs me even as an *experienced* developer is > that Zope 3's pervasive security has a heavy cost during > development. It > happened to me quite frequently I had to debug why Zope 3 didn't > let me > do something I should do, and I had to dig through ZCML files and add > security declarations quite often, and mess about with __parent__ > quite > often, and use removeAllSecurityProxies() and such quite often. I > consider this very off-putting to any developer, experienced or not. > > Regards, > > Martijn > > _______________________________________________ > z3-five mailing list > z3-five at codespeak.net > http://codespeak.net/mailman/listinfo/z3-five > From y.2007- at wcm-solutions.de Wed Jan 31 18:14:40 2007 From: y.2007- at wcm-solutions.de (yuppie) Date: Wed, 31 Jan 2007 18:14:40 +0100 Subject: [z3-five] using getToolByName in utility In-Reply-To: <45C0BFD3.6060801@gmx.net> References: <45C06D23.8040103@gmx.net> <45C08966.9060905@wcm-solutions.de> <45C0A00D.3010608@gmx.net> <45C0A8CC.8010508@wcm-solutions.de> <45C0BFD3.6060801@gmx.net> Message-ID: <45C0CE80.4060202@wcm-solutions.de> Hi Dennis! Dennis Schulz wrote: > In the applychanges the object is still wrapped into acquisition correctly. > and gets passed to field.set(adapter,newvalue) with the right context. > > In the set of the field the aq chain is ok as well > it calls then setattr(object, self.__name__, value) > > now the set of the alchemist ValidatedProperty is invoked. > in the set method there the aq_chain is destroyed. > > I dont know why the set is called without acquisition context. Acquisition isn't available in __setattr__ :( CMFCalendar.browser.event (on SVN trunk) does something similar, but in that case an adapter is used. The wrapped object is the context of the adapter, not the adapter itself. So the aq_chain is not destroyed in __setattr__. > So you see any way to change something here? No idea. (Besides using an adapter.) The 'tools as local utilities' work currently done on CMF trunk will make this much easier. You no longer need Acquisition to get the tool (=utility). Cheers, Yuppie From pw_lists at slinkp.com Wed Jan 31 19:16:25 2007 From: pw_lists at slinkp.com (Paul Winkler) Date: Wed, 31 Jan 2007 13:16:25 -0500 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45C06C46.8040103@simplistix.co.uk> References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> <45C06C46.8040103@simplistix.co.uk> Message-ID: <20070131181625.GC7183@slinkp.com> On Wed, Jan 31, 2007 at 10:15:34AM +0000, Chris Withers wrote: > Martijn Faassen wrote: > > My ideas have evolved to the point that I like trusted code more and > > more, and I'm not sure it's worth the effort to expend a lot of time to > > make untrusted code work. > > Oh I dunno, I think this an exceptionally important use case which the > Zope community seems to be ignoring more and more and which used to be > the main thing that brought people to Zope: the ability for a trusted > but not necessarily fully competent user to write code while protecting > them from accessing data they shouldn't and trying to help them not > shoot themselves in the foot... Hmm, was that really a big draw to Zope? Considering the relative popularity of various alternatives (php, rails,...) none of which have a concept of "untrusted" code, I've sometimes wondered if the whole idea of untrusted code is a solution in search of a problem. But I'd be curious to hear evidence otherwise. -- Paul Winkler http://www.slinkp.com From chris at simplistix.co.uk Wed Jan 31 21:22:16 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 31 Jan 2007 20:22:16 +0000 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <20070131181625.GC7183@slinkp.com> References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> <45C06C46.8040103@simplistix.co.uk> <20070131181625.GC7183@slinkp.com> Message-ID: <45C0FA78.9020208@simplistix.co.uk> Paul Winkler wrote: > Hmm, was that really a big draw to Zope? When Zope was growing rapidly (1999-2003 for me, others may disagree) everyone who came to Zope came to it by installing it and writing TTW code. That was predicated on what I'm talking about ;-) > Considering the relative > popularity of various alternatives (php, rails,...) I dunno about rails, but considering how heinously insecure php is, I would quite happilly sacrifice popularity for security. > none of which have > a concept of "untrusted" code, I've sometimes wondered if the whole > idea of untrusted code is a solution in search of a problem. > But I'd be curious to hear evidence otherwise. In Zope 2, almost all components had to worry about "untrusted" code. I'd imagine in Zope 3 that should change to being: - only publication objects, which must surely control all access based on security declarations of the objects involved and deny all access to objects without any assertions - only code that is designed to be scripted by Zope 2's semi-trusted users. I'd imagine this would be a much smaller amount of code, and I'd imagine it would be designed to be highly encapsulated versus the pervasiveness of Zope 2's "untrusted code" However, security is also about resricting access to data objects. Zope 2's integrated security policy was a huge huge win for this, I hope that doesn't ever get lost in Zope 3. cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Wed Jan 31 21:10:02 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 31 Jan 2007 20:10:02 +0000 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> <45C06C46.8040103@simplistix.co.uk> Message-ID: <45C0F79A.6060908@simplistix.co.uk> Martijn Faassen wrote: > I agree the use case exists. I'm not sure how important it is, though > traditionally it's been quite important to Zope 2. I think the userbase who used to thrive on this have, for the whole, moved over to Plone. > I think there are a lot of *other* things we should be doing first to > make an inexperienced developer happier with Zope 3. Some of those > things we've been trying to do with Grok. Agreed. I think supporting the use case I mention is an application of zope 3, not zope 3 itself... > One of the things that bugs me even as an *experienced* developer is > that Zope 3's pervasive security has a heavy cost during development. I don't agree. Zope's fundamental premise is publishing a tree of objects by various protocols. If you do that, you need to make sure you're not exposing things to abuse by untrusted users, and the only way to do that is to deny-by-default everything to publishing protocols. Perhaps the way this is currently done is Zope 3 isn't as developer friendly as it should be, but you really really want a big deny-by-default hammer somewhere between "trusted code" and any publishing protocol. > It > happened to me quite frequently I had to debug why Zope 3 didn't let me > do something I should do, and I had to dig through ZCML files I thought we'd established that zcml sucks? ;-) > and add > security declarations quite often, I think you need to positively declare the security assertions relating to objects (be they simple python types, functions, methods or anything else) somewhere... > and mess about with __parent__ quite > often, Yes, the containment constraint of Zope 2 and 3 security policies is annoying. I hope to implement a security policy for zope 3 at some point that is purely context-based rather than containment based. > and use removeAllSecurityProxies() and such quite often. It's a shame you have to do that :-( cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From d.schulz81 at gmx.net Thu Feb 1 11:04:33 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Thu, 01 Feb 2007 11:04:33 +0100 Subject: [z3-five] using getToolByName in utility In-Reply-To: <45C0CE80.4060202@wcm-solutions.de> References: <45C06D23.8040103@gmx.net> <45C08966.9060905@wcm-solutions.de> <45C0A00D.3010608@gmx.net> <45C0A8CC.8010508@wcm-solutions.de> <45C0BFD3.6060801@gmx.net> <45C0CE80.4060202@wcm-solutions.de> Message-ID: <45C1BB31.3070908@gmx.net> Hello Yuppie, I looked at EventTypeVocabulary in CMFCalendar.browser.event. In the Utitily itself I cant see any difference to mine. Can you tell where it is used? I my case does it make I create an adapter in the applychanges and then use the context of the adapter instead of the adapter? set(adapter,newvalue) Thanks, Dennis yuppie escribi?: > Hi Dennis! > > > Dennis Schulz wrote: >> In the applychanges the object is still wrapped into acquisition >> correctly. >> and gets passed to field.set(adapter,newvalue) with the right context. >> >> In the set of the field the aq chain is ok as well >> it calls then setattr(object, self.__name__, value) >> >> now the set of the alchemist ValidatedProperty is invoked. >> in the set method there the aq_chain is destroyed. >> >> I dont know why the set is called without acquisition context. > > Acquisition isn't available in __setattr__ :( > > CMFCalendar.browser.event (on SVN trunk) does something similar, but > in that case an adapter is used. The wrapped object is the context of > the adapter, not the adapter itself. So the aq_chain is not destroyed > in __setattr__. > >> So you see any way to change something here? > > No idea. (Besides using an adapter.) The 'tools as local utilities' > work currently done on CMF trunk will make this much easier. You no > longer need Acquisition to get the tool (=utility). > > > Cheers, > > Yuppie > > From y.2007- at wcm-solutions.de Thu Feb 1 11:43:59 2007 From: y.2007- at wcm-solutions.de (yuppie) Date: Thu, 01 Feb 2007 11:43:59 +0100 Subject: [z3-five] using getToolByName in utility In-Reply-To: <45C1BB31.3070908@gmx.net> References: <45C06D23.8040103@gmx.net> <45C08966.9060905@wcm-solutions.de> <45C0A00D.3010608@gmx.net> <45C0A8CC.8010508@wcm-solutions.de> <45C0BFD3.6060801@gmx.net> <45C0CE80.4060202@wcm-solutions.de> <45C1BB31.3070908@gmx.net> Message-ID: <45C1C46F.2030009@wcm-solutions.de> Hi Dennis! Dennis Schulz wrote: > I looked at EventTypeVocabulary in CMFCalendar.browser.event. > In the Utitily itself I cant see any difference to mine. > Can you tell where it is used? The name of the utility is 'cmf.calendar.AvailableEventTypes'. It is used in the 'categories' field of IEventSchema. The EventSchemaAdapter implements this interface, not the persistent Event object itself. > I my case does it make I create an adapter in the applychanges and then use the context of the adapter instead of the adapter? > > set(adapter,newvalue) In CMFCalendar we have to adapt the old Event class anyway. Don't know if it makes sense to implement your stuff in a similar way. Can't help you with that. Cheers, Yuppie From regebro at gmail.com Thu Feb 1 11:51:11 2007 From: regebro at gmail.com (Lennart Regebro) Date: Thu, 1 Feb 2007 11:51:11 +0100 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45C0FA78.9020208@simplistix.co.uk> References: <45BE68A8.5030403@simplistix.co.uk> <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> <45C06C46.8040103@simplistix.co.uk> <20070131181625.GC7183@slinkp.com> <45C0FA78.9020208@simplistix.co.uk> Message-ID: <319e029f0702010251i243638cese22b4425ddce868b@mail.gmail.com> On 1/31/07, Chris Withers wrote: > When Zope was growing rapidly (1999-2003 for me, others may disagree) > everyone who came to Zope came to it by installing it and writing TTW > code. That was predicated on what I'm talking about ;-) Aboslutely. But I'm not sure that the draw was (or is) that unexperiencd users could do things in a untrusted context. The draw was, I think, always the ease and speed of development, and the way that you could do just one little thing and immediately see it working, without the need to write loads of code first. The untrusted security context was the price you had to pay for the speedy development. You needed to dance around the security restrictions and do easy things in a complicated way. -- Lennart Regebro: Python, Zope, CPS, Plone consulting. +33 661 58 14 64 From d.schulz81 at gmx.net Thu Feb 1 15:15:34 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Thu, 01 Feb 2007 15:15:34 +0100 Subject: [z3-five] using getToolByName in utility In-Reply-To: <45C1C46F.2030009@wcm-solutions.de> References: <45C06D23.8040103@gmx.net> <45C08966.9060905@wcm-solutions.de> <45C0A00D.3010608@gmx.net> <45C0A8CC.8010508@wcm-solutions.de> <45C0BFD3.6060801@gmx.net> <45C0CE80.4060202@wcm-solutions.de> <45C1BB31.3070908@gmx.net> <45C1C46F.2030009@wcm-solutions.de> Message-ID: <45C1F606.1060800@gmx.net> Hi Yuppie, To make use of the adapter like you did the Products.CMFDefault.formlib is necessary? The Products.CMFDefault.formlib package is not included into Plone 2.5.2 I am working with. I guess it will be part of Plone 3.0. Can I use it in Plone 2.5.2? Dennis yuppie escribi?: > Hi Dennis! > > > Dennis Schulz wrote: >> I looked at EventTypeVocabulary in CMFCalendar.browser.event. In the >> Utitily itself I cant see any difference to mine. >> Can you tell where it is used? > > The name of the utility is 'cmf.calendar.AvailableEventTypes'. It is > used in the 'categories' field of IEventSchema. The EventSchemaAdapter > implements this interface, not the persistent Event object itself. > >> I my case does it make I create an adapter in the applychanges and >> then use the context of the adapter instead of the adapter? >> >> set(adapter,newvalue) > > In CMFCalendar we have to adapt the old Event class anyway. Don't know > if it makes sense to implement your stuff in a similar way. Can't help > you with that. > > > Cheers, > > Yuppie > > From y.2007- at wcm-solutions.de Thu Feb 1 16:16:09 2007 From: y.2007- at wcm-solutions.de (yuppie) Date: Thu, 01 Feb 2007 16:16:09 +0100 Subject: [z3-five] using getToolByName in utility In-Reply-To: <45C1F606.1060800@gmx.net> References: <45C06D23.8040103@gmx.net> <45C08966.9060905@wcm-solutions.de> <45C0A00D.3010608@gmx.net> <45C0A8CC.8010508@wcm-solutions.de> <45C0BFD3.6060801@gmx.net> <45C0CE80.4060202@wcm-solutions.de> <45C1BB31.3070908@gmx.net> <45C1C46F.2030009@wcm-solutions.de> <45C1F606.1060800@gmx.net> Message-ID: <45C20439.8080102@wcm-solutions.de> Hi Dennis! Dennis Schulz wrote: > To make use of the adapter like you did the Products.CMFDefault.formlib > is necessary? > The Products.CMFDefault.formlib package is not included into Plone 2.5.2 > I am working with. I guess it will be part of Plone 3.0. > Can I use it in Plone 2.5.2? I never used alchemist, but I doubt using Products.CMFDefault.formlib in combination with alchemist makes much sense. And without modifications you can't use that code in Plone 2.5.2 anyway. Other possible approaches: - The right way to solve your problem would be using a local site manager. Even if your tools are not registered as utilities, you can get hold of the site root and therefor of the tool without using acquisition. Plone 3.0 might give you some hints how to set this up. - If you don't need the validation at field level, the easiest solution might be subclassing the field and disabling the validation by overriding validate(). HTH, Yuppie From pw_lists at slinkp.com Thu Feb 1 16:41:19 2007 From: pw_lists at slinkp.com (Paul Winkler) Date: Thu, 1 Feb 2007 10:41:19 -0500 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <45C0FA78.9020208@simplistix.co.uk> References: <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> <45C06C46.8040103@simplistix.co.uk> <20070131181625.GC7183@slinkp.com> <45C0FA78.9020208@simplistix.co.uk> Message-ID: <20070201154119.GA7431@slinkp.com> On Wed, Jan 31, 2007 at 08:22:16PM +0000, Chris Withers wrote: > Paul Winkler wrote: > >Hmm, was that really a big draw to Zope? > > When Zope was growing rapidly (1999-2003 for me, others may disagree) > everyone who came to Zope came to it by installing it and writing TTW > code. That was predicated on what I'm talking about ;-) Yeah, but nowhere is it written in stone that the security model of TTW code needs to be different than the security model of filesystem code. I'm heretically suggesting that we consider whether this distinction does more harm than good. For a trivial example, the old "import re is not allowed" FAQ. IIRC the motivation for disallowing re is that regular expressions can be indeterminately slow and a naive scripter might create code that's an easy DOS target - or a malicious scripter might do so deliberately. In that case at least, I'm now pretty firmly on the side of "give 'em the rope and if they hang themselves, it's their own problem". Where this hypothesis obviously falls down is the "multiple customers (each with their own engineering staff) sharing one Zope" scenario. Some Zope hosting providers run their low-budget plans this way. You can't leave customer A a giant back door into customer B's data. In this case, the default zope 2 security model makes a lot of sense. But since as far as I know Zope is the only framework that supports that hosting model, again I wonder if the complexity is worth it. If the only option for hosting multiple customers is to give each its own instance, things get much simpler. OTOH, being in the Zope hosting business seems to be difficult enough already without exploding the number of long-running processes required. I doubt http://www.objectis.org/about-en/objectis/index_html would have the resources for the model I'm suggesting. -- Paul Winkler http://www.slinkp.com From chrism at plope.com Thu Feb 1 16:47:10 2007 From: chrism at plope.com (Chris McDonough) Date: Thu, 1 Feb 2007 10:47:10 -0500 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <20070201154119.GA7431@slinkp.com> References: <45BE7BBF.7060805@simplistix.co.uk> <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> <45C06C46.8040103@simplistix.co.uk> <20070131181625.GC7183@slinkp.com> <45C0FA78.9020208@simplistix.co.uk> <20070201154119.GA7431@slinkp.com> Message-ID: On Feb 1, 2007, at 10:41 AM, Paul Winkler wrote: > > On Wed, Jan 31, 2007 at 08:22:16PM +0000, Chris Withers wrote: >> Paul Winkler wrote: >>> Hmm, was that really a big draw to Zope? >> >> When Zope was growing rapidly (1999-2003 for me, others may disagree) >> everyone who came to Zope came to it by installing it and writing TTW >> code. That was predicated on what I'm talking about ;-) > > Yeah, but nowhere is it written in stone that the security model of > TTW code needs to be different than the security model of filesystem > code. I'm heretically suggesting that we consider whether this > distinction does more harm than good. For a trivial example, the old > "import re is not allowed" FAQ. IIRC the motivation for disallowing > re is that regular expressions can be indeterminately slow and a naive > scripter might create code that's an easy DOS target - or a malicious > scripter might do so deliberately. In that case at least, I'm now > pretty firmly on the side of "give 'em the rope and if they hang > themselves, it's their own problem". FTR, I'm in the camp of "lets just have one programming model"... http://www.plope.com/Members/chrism/ttb_programming FWIW, I haven't yet used "grok" but from what I've seen of it, it seems consistent with the ideas in that blog entry. - C From regebro at gmail.com Fri Feb 2 10:15:10 2007 From: regebro at gmail.com (Lennart Regebro) Date: Fri, 2 Feb 2007 10:15:10 +0100 Subject: [z3-five] Unexpectedly unprotected code In-Reply-To: <20070201154119.GA7431@slinkp.com> References: <45BE7DE8.7000706@weitershausen.de> <45BEF8A8.8040806@simplistix.co.uk> <45C06C46.8040103@simplistix.co.uk> <20070131181625.GC7183@slinkp.com> <45C0FA78.9020208@simplistix.co.uk> <20070201154119.GA7431@slinkp.com> Message-ID: <319e029f0702020115h2bb47990i7ec6ed38d7a4b926@mail.gmail.com> On 2/1/07, Paul Winkler wrote: > Yeah, but nowhere is it written in stone that the security model of > TTW code needs to be different than the security model of filesystem > code. I'm heretically suggesting that we consider whether this > distinction does more harm than good. For a trivial example, the old > "import re is not allowed" FAQ. IIRC the motivation for disallowing > re is that regular expressions can be indeterminately slow and a naive > scripter might create code that's an easy DOS target - or a malicious > scripter might do so deliberately. In that case at least, I'm now > pretty firmly on the side of "give 'em the rope and if they hang > themselves, it's their own problem". For re, yes. But for other things, no. It's a case of multiple not serious security holes possibly combining nto a serous one. If you can do anything in a TTW, then all you need is to find one hole, that allows to change a TTW-script, and all security of the system is completely gone. So that that TTW code needs a different security model than filesystem code IS written in stone. However, is is not written in stone that the quick hacky development you can do in Zope2 must be TTW. ;) -- Lennart Regebro: Python, Zope, CPS, Plone consulting. +33 661 58 14 64 From daniel at infrae.com Mon Feb 5 15:35:00 2007 From: daniel at infrae.com (Daniel Nouri) Date: Mon, 05 Feb 2007 15:35:00 +0100 Subject: [z3-five] formlib acquisition error Message-ID: Hi! I'm using Five 1.4.1 with Zope 2.9.6 and using the (base-) classes Products.Five.formlib.formbase.PageForm Products.Five.browser.pagetemplatefile.ViewPageTemplateFile I'm trying to call self.template() in an action handler, but that fails because self (the form) is not acquistion-wrapped (at all) in the body of the action handler, thus @form.action("foo") def action_foo(self, action, data): return self.template() is bound to fail. -- Daniel Nouri Infrae ? http://infrae.com From maciej.wisniowski at coig.katowice.pl Tue Feb 6 07:31:39 2007 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Tue, 06 Feb 2007 07:31:39 +0100 Subject: [z3-five] formlib acquisition error In-Reply-To: References: Message-ID: <45C820CB.3020707@coig.katowice.pl> > I'm using Five 1.4.1 with Zope 2.9.6 and using the (base-) classes > > Products.Five.formlib.formbase.PageForm > Products.Five.browser.pagetemplatefile.ViewPageTemplateFile > > I'm trying to call self.template() in an action handler, but that fails > because self (the form) is not acquistion-wrapped (at all) in the body > of the action handler, thus > > @form.action("foo") > def action_foo(self, action, data): > return self.template() > > is bound to fail. > You have import of ViewPageTemplateFile. Do you use this to create self.template object? If so then maybe try with from Products.Five.browser.pagetemplatefile import \ ZopeTwoPageTemplateFile Take a look at Chris Withers' thread about "(re)using zpt macros from view page templates" from 2007-01-28. Maybe this will help somehow. -- Maciej Wisniowski From tim at sitefusion.co.uk Tue Feb 6 11:27:12 2007 From: tim at sitefusion.co.uk (Tim Hicks) Date: Tue, 06 Feb 2007 10:27:12 +0000 Subject: [z3-five] formlib acquisition error In-Reply-To: References: Message-ID: <45C85800.3010108@sitefusion.co.uk> Daniel Nouri wrote: > Hi! > > I'm using Five 1.4.1 with Zope 2.9.6 and using the (base-) classes > > Products.Five.formlib.formbase.PageForm > Products.Five.browser.pagetemplatefile.ViewPageTemplateFile > > I'm trying to call self.template() in an action handler, but that fails > because self (the form) is not acquistion-wrapped (at all) in the body > of the action handler, thus > > @form.action("foo") > def action_foo(self, action, data): > return self.template() > > is bound to fail. I had a problem like this a few weeks ago. When I discussed it with alecm on #plone, he seemed to know what was causing the problem (something to do with the form.action decorator storing objects in such a way that acquisition got stripped). Unfortunately, the appropriate fix was, apparently, not obvious or easy. The workaround that I employed was to simply declare my template as a full-blown view and then look it up with getMultiAdapter instead of as an attribute of the form. Maybe alecm can remember more... Tim From chris at simplistix.co.uk Wed Feb 7 17:06:28 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 07 Feb 2007 16:06:28 +0000 Subject: [z3-five] testings event firing Message-ID: <45C9F904.4090904@simplistix.co.uk> Hi All, This starts of with me wanting to test that I've inserted the correct calls to event.notify in my code. So, the natural way would be to have a dummy subscriber, and then exercise the code where event.notify should be present, right? Okay, but if I just do: class mySubscriber: def __init__(self): self.events = [] def __call__(self,*args,**kw): self.events.append((args,kw)) s = mySubscriber() provideHandler(s,IWhatever) ....then that handler will get called for every event in the test run, right? How do I get rid of it once I'm done with a particular test? I tried playing with subclassing zope.component.testing.PlacelessSetup but that trashed all my normal zcml setup. I guess a secondary question then becomes how do you unit test that the assignments in your .zcml files are correct? Is this the realm of functional tests? If so, how do you run functional and unit tests in the same run? Are there any docs or examples of all this? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Wed Feb 7 17:39:35 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 07 Feb 2007 17:39:35 +0100 Subject: [z3-five] testings event firing In-Reply-To: <45C9F904.4090904@simplistix.co.uk> References: <45C9F904.4090904@simplistix.co.uk> Message-ID: <45CA00C7.7040700@weitershausen.de> Chris Withers wrote: > This starts of with me wanting to test that I've inserted the correct > calls to event.notify in my code. > > So, the natural way would be to have a dummy subscriber, and then > exercise the code where event.notify should be present, right? Sure, or simply use an already existing setup from zope.component.eventtesting. There are a few tests (also in Five, I think) that demonstrate how to use it. > Okay, but if I just do: > > class mySubscriber: > > def __init__(self): > self.events = [] > > def __call__(self,*args,**kw): > self.events.append((args,kw)) > > s = mySubscriber() > provideHandler(s,IWhatever) > > ....then that handler will get called for every event in the test run, > right? Yup. > How do I get rid of it once I'm done with a particular test? > > I tried playing with subclassing zope.component.testing.PlacelessSetup > but that trashed all my normal zcml setup. Well, yeah, of course it does. PlacelessSetup is a bad name and it's actually nowadays just a small shim for zope.testing.cleanup.CleanUp. "CleanUp" says it all: it cleans up after each test. Completely. No compromises. That's important for unit tests. So, the question is, are you writing a fucntional test or a unit test? In a unit test, you might not actually want to (or have to!) load all of your ZCML, but only register those components necessary for the test. And then it's not so much of a problem that everything gets torn down after each test (in fact, you'd rather like that in a unit test). In a functional test, you load the ZCML once for a whole bunch of tests and then execute all your tests within that setup. Individual tests shouldn't really modify the registries then. The common way to do this is to use zope.testing's test layer support. You put those tests that require common setup routines that may take long to load (e.g. booting up all of the ZCML you have) into one layer and let the layer do that setup (and tear down). zope.testing has some doctests on layers. > I guess a secondary question then becomes how do you unit test that the > assignments in your .zcml files are correct? That's not a unit test, that's an integration / functional test. > Is this the realm of functional tests? If so, how do you run functional > and unit tests in the same run? Are there any docs or examples of all this? Five has unit tests and funtional tests, though they are sometimes hard to distinguish because a) even some unit tests do their setup by calling ZCML, which is mostly overkill and slows them down b) functional tests do their own setup and don't rely on a common setup layer like Zope 3 functional tests do. For Zope 2.11 I'd like to refactor Five's functional tests to use a common setup layer (one that simply bootstraps Five's ZCML) and cleanup unit tests not to use ZCML to make them even more light-weight. -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From d.schulz81 at gmx.net Thu Feb 8 00:19:00 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Thu, 08 Feb 2007 00:19:00 +0100 Subject: [z3-five] Plone Tool without acquisition Message-ID: <45CA5E64.4040801@gmx.net> > - The right way to solve your problem would be using a local site > manager. Even if your tools are not registered as utilities, you can > get hold of the site root and therefor of the tool without using > acquisition. Plone 3.0 might give you some hints how to set this up. I am not familiar with the Plone 3 code. Can anyone point me to an example where I can see how to set up a local site manager? I registered What is the easiest way to get hold of the site root so I can use the Plone tool without acquisition? Regards, Dennis From philipp at weitershausen.de Thu Feb 8 02:33:16 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 08 Feb 2007 02:33:16 +0100 Subject: [z3-five] Plone Tool without acquisition In-Reply-To: <45CA5E64.4040801@gmx.net> References: <45CA5E64.4040801@gmx.net> Message-ID: <45CA7DDC.1080107@weitershausen.de> Dennis Schulz wrote: >> - The right way to solve your problem would be using a local site >> manager. Even if your tools are not registered as utilities, you can >> get hold of the site root and therefor of the tool without using >> acquisition. Plone 3.0 might give you some hints how to set this up. > > I am not familiar with the Plone 3 code. > Can anyone point me to an example where I can see how to set up a local > site manager? > > I registered > > class="Products.CMFPlone.Portal.PloneSite" /> > > What is the easiest way to get hold of the site root so I can use the > Plone tool without acquisition? Why would you want to get hold of the site root? Assuming that the CMF tools are registered as local utilities, you should simply be able to say: from zope.component import getUtility from Products.CMFPlone.interfaces import IPloneTool # verify this plone_tool = getUtility(IPloneTool) Zope will automatically figure out that where it should get that tool from (because it traversed over the site). -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From chris at simplistix.co.uk Thu Feb 8 09:35:35 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Thu, 08 Feb 2007 08:35:35 +0000 Subject: [z3-five] Plone Tool without acquisition In-Reply-To: <45CA7DDC.1080107@weitershausen.de> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> Message-ID: <45CAE0D7.1000800@simplistix.co.uk> Philipp von Weitershausen wrote: > Why would you want to get hold of the site root? Assuming that the CMF > tools are registered as local utilities, you should simply be able to say: > > from zope.component import getUtility > from Products.CMFPlone.interfaces import IPloneTool # verify this > > plone_tool = getUtility(IPloneTool) > > Zope will automatically figure out that where it should get that tool > from (because it traversed over the site). Really? That feels a bit DWIM :-( I thought you had to pass in a context to get local utilities? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Thu Feb 8 09:33:37 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Thu, 08 Feb 2007 08:33:37 +0000 Subject: [z3-five] testings event firing In-Reply-To: <45CA00C7.7040700@weitershausen.de> References: <45C9F904.4090904@simplistix.co.uk> <45CA00C7.7040700@weitershausen.de> Message-ID: <45CAE061.7080008@simplistix.co.uk> Philipp von Weitershausen wrote: > Sure, or simply use an already existing setup from > zope.component.eventtesting. ...which is only available in 2.10 ;-) > In a functional test, you load the ZCML once for a whole bunch of tests > and then execute all your tests within that setup. What's the canonical way to load all the zcml that Zope normally does? > shouldn't really modify the registries then. The common way to do this > is to use zope.testing's test layer support. You put those tests that > require common setup routines that may take long to load (e.g. booting > up all of the ZCML you have) into one layer and let the layer do that > setup (and tear down). zope.testing has some doctests on layers. Yup, I've read all those I could find, but I'm still left wondering how to fire up all the ZCML ;-) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From daniel at infrae.com Thu Feb 8 10:50:22 2007 From: daniel at infrae.com (Daniel Nouri) Date: Thu, 08 Feb 2007 10:50:22 +0100 Subject: [z3-five] testings event firing In-Reply-To: <45CAE061.7080008@simplistix.co.uk> References: <45C9F904.4090904@simplistix.co.uk> <45CA00C7.7040700@weitershausen.de> <45CAE061.7080008@simplistix.co.uk> Message-ID: <45CAF25E.3070309@infrae.com> Chris Withers wrote: > Philipp von Weitershausen wrote: >> Sure, or simply use an already existing setup from >> zope.component.eventtesting. > > ...which is only available in 2.10 ;-) > >> In a functional test, you load the ZCML once for a whole bunch of tests >> and then execute all your tests within that setup. > > What's the canonical way to load all the zcml that Zope normally does? > >> shouldn't really modify the registries then. The common way to do this >> is to use zope.testing's test layer support. You put those tests that >> require common setup routines that may take long to load (e.g. booting >> up all of the ZCML you have) into one layer and let the layer do that >> setup (and tear down). zope.testing has some doctests on layers. > > Yup, I've read all those I could find, but I'm still left wondering how > to fire up all the ZCML ;-) I know you wouldn't look at Plone for an example :p so here's an example from Silva: https://infrae.com/svn/Silva/branch/zope-2.10/tests/layer.py Look at SilvaZCMLLayer, which does the setup for all of Silva's integration tests. It has ``zcml.load_site()`` and it also registers a subscriber for anything (for which you can use your own list just as well). -- Daniel Nouri Infrae ? http://infrae.com From philipp at weitershausen.de Thu Feb 8 11:02:11 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 8 Feb 2007 11:02:11 +0100 Subject: [z3-five] Plone Tool without acquisition In-Reply-To: <45CAE0D7.1000800@simplistix.co.uk> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAE0D7.1000800@simplistix.co.uk> Message-ID: On 8 Feb 2007, at 09:35 , Chris Withers wrote: > Philipp von Weitershausen wrote: > >> Why would you want to get hold of the site root? Assuming that the >> CMF tools are registered as local utilities, you should simply be >> able to say: >> from zope.component import getUtility >> from Products.CMFPlone.interfaces import IPloneTool # verify this >> plone_tool = getUtility(IPloneTool) >> Zope will automatically figure out that where it should get that >> tool from (because it traversed over the site). > > Really? That feels a bit DWIM :-( Yes. > I thought you had to pass in a context to get local utilities? No. That's the point, the context is found during traversal and other code doesn't have to be aware of the context. In fact, why would code *care* where the utility is from? All it wants is a utility, be it local or global. From y.2007- at wcm-solutions.de Thu Feb 8 11:06:18 2007 From: y.2007- at wcm-solutions.de (yuppie) Date: Thu, 08 Feb 2007 11:06:18 +0100 Subject: [z3-five] Plone Tool without acquisition In-Reply-To: <45CA7DDC.1080107@weitershausen.de> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> Message-ID: <45CAF61A.20000@wcm-solutions.de> Hi Philipp! Philipp von Weitershausen wrote: > Dennis Schulz wrote: >>> - The right way to solve your problem would be using a local site >>> manager. Even if your tools are not registered as utilities, you can >>> get hold of the site root and therefor of the tool without using >>> acquisition. Plone 3.0 might give you some hints how to set this up. >> I am not familiar with the Plone 3 code. >> Can anyone point me to an example where I can see how to set up a local >> site manager? >> >> I registered >> >> > class="Products.CMFPlone.Portal.PloneSite" /> >> >> What is the easiest way to get hold of the site root so I can use the >> Plone tool without acquisition? > > Why would you want to get hold of the site root? Assuming that the CMF > tools are registered as local utilities, you should simply be able to say: > > from zope.component import getUtility > from Products.CMFPlone.interfaces import IPloneTool # verify this > > plone_tool = getUtility(IPloneTool) > > Zope will automatically figure out that where it should get that tool > from (because it traversed over the site). You missed the start of this thread. We were not talking about a clean solution that requires properly registered and acquisition wrapped tools. We were talking about a hack for using tools in vocabularies without acquisition context. Right now, in Zope 2.9, without the not yet existing five.localsitemanager. In Zope 2.10 I can use zope.app.component.hooks.getSite() to get the acquisition wrapped site. Don't know what needs to be set up in Zope 2.9 to have this available. Cheers, Yuppie From philipp at weitershausen.de Thu Feb 8 12:00:54 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 8 Feb 2007 12:00:54 +0100 Subject: [z3-five] Plone Tool without acquisition In-Reply-To: <45CAF61A.20000@wcm-solutions.de> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAF61A.20000@wcm-solutions.de> Message-ID: <1EF3E0C7-3070-4C79-88D3-1EB118AF2690@weitershausen.de> On 8 Feb 2007, at 11:06 , yuppie wrote: > Philipp von Weitershausen wrote: >> Dennis Schulz wrote: >>>> - The right way to solve your problem would be using a local >>>> site manager. Even if your tools are not registered as >>>> utilities, you can get hold of the site root and therefor of the >>>> tool without using acquisition. Plone 3.0 might give you some >>>> hints how to set this up. >>> I am not familiar with the Plone 3 code. >>> Can anyone point me to an example where I can see how to set up >>> a local site manager? >>> >>> I registered >>> >>> >> class="Products.CMFPlone.Portal.PloneSite" /> >>> What is the easiest way to get hold of the site root so I can >>> use the Plone tool without acquisition? >> Why would you want to get hold of the site root? Assuming that the >> CMF tools are registered as local utilities, you should simply be >> able to say: >> from zope.component import getUtility >> from Products.CMFPlone.interfaces import IPloneTool # verify this >> plone_tool = getUtility(IPloneTool) >> Zope will automatically figure out that where it should get that >> tool from (because it traversed over the site). > > You missed the start of this thread. Possibly. As far as I'm concerned, the thread started with Dennis's email, though, didn't it? > We were not talking about a clean solution that requires properly > registered and acquisition wrapped tools. > > We were talking about a hack for using tools in vocabularies > without acquisition context. Right now, in Zope 2.9, without the > not yet existing five.localsitemanager. Gotcha. > In Zope 2.10 I can use zope.app.component.hooks.getSite() to get > the acquisition wrapped site. Don't know what needs to be set up in > Zope 2.9 to have this available. Well, the canonical way in both Zope 2.10 and 2.9 is to make your plone site an ISite. However, in Zope 2.10 that's a lot cleaner and nicer (though I still want to make it even nicer for Zope 2.11). In Five 1.3/1.4 on Zope 2.9, this can be done using the directive. This will add the IPossibleSite interface to the PloneSite class. That means plone sites *can* be turned into ISites, you just need to perform the actual operation on each individual object. To do that, you need to call Products.Five.site.localsite.enableLocalSiteHook(the_plone_site) on the plone site object. This will install a traversal hook so the site is remembered during traversal. As said, don't use this code past Zope 2.9. From y.2007- at wcm-solutions.de Thu Feb 8 12:10:05 2007 From: y.2007- at wcm-solutions.de (yuppie) Date: Thu, 08 Feb 2007 12:10:05 +0100 Subject: [z3-five] Plone Tool without acquisition In-Reply-To: <1EF3E0C7-3070-4C79-88D3-1EB118AF2690@weitershausen.de> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAF61A.20000@wcm-solutions.de> <1EF3E0C7-3070-4C79-88D3-1EB118AF2690@weitershausen.de> Message-ID: <45CB050D.80001@wcm-solutions.de> Philipp von Weitershausen wrote: > On 8 Feb 2007, at 11:06 , yuppie wrote: >> You missed the start of this thread. > > Possibly. As far as I'm concerned, the thread started with Dennis's > email, though, didn't it? Oops! I didn't notice Dennis started a new thread. But he did follow up to an older thread where he explained what he wants to do. Cheers, Yuppie From d.schulz81 at gmx.net Thu Feb 8 20:24:08 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Thu, 08 Feb 2007 20:24:08 +0100 Subject: [z3-five] Plone Tool without acquisition In-Reply-To: <45CB050D.80001@wcm-solutions.de> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAF61A.20000@wcm-solutions.de> <1EF3E0C7-3070-4C79-88D3-1EB118AF2690@weitershausen.de> <45CB050D.80001@wcm-solutions.de> Message-ID: <45CB78D8.8050200@gmx.net> Hi, sorry for the confusion by the new thread. I think for my current project in Zope 2.9.6 it does not make sense to use local utilities. I have to find workarounds for the moment and wait for plone 3 to work like that. I just would have been nice...... Dennis yuppie escribi?: > Philipp von Weitershausen wrote: > >> On 8 Feb 2007, at 11:06 , yuppie wrote: >> >>> You missed the start of this thread. >>> >> Possibly. As far as I'm concerned, the thread started with Dennis's >> email, though, didn't it? >> > > Oops! I didn't notice Dennis started a new thread. But he did follow up > to an older thread where he explained what he wants to do. > > Cheers, Yuppie > > _______________________________________________ > z3-five mailing list > z3-five at codespeak.net > http://codespeak.net/mailman/listinfo/z3-five > > > From d.schulz81 at gmx.net Thu Feb 8 21:47:04 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Thu, 08 Feb 2007 21:47:04 +0100 Subject: [z3-five] Security in Content Classes Message-ID: <45CB8C48.7090701@gmx.net> Here a short question about security, In Zope 2 style product classes I have to protect the methods against being called. With Zope 3 views the whole view is protected by a permission in zcml and this is not necessary? But the content object still should be protected (is derived from SimpleItem) Cheers Dennis From lists at zopyx.com Fri Feb 9 13:00:09 2007 From: lists at zopyx.com (Andreas Jung) Date: Fri, 09 Feb 2007 13:00:09 +0100 Subject: [z3-five] Marker interfaces in Five 1.0.2 Message-ID: <45D61439174DCEDEBA4C3543@vg180585.grp.haufemg.com> Hi, don't stone me to death but is there a way to attach marker interfaces of objects in Five 1.0.2? Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20070209/544a9797/attachment.pgp From chris at simplistix.co.uk Fri Feb 9 14:26:43 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Fri, 09 Feb 2007 13:26:43 +0000 Subject: [z3-five] Plone Tool without acquisition In-Reply-To: References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAE0D7.1000800@simplistix.co.uk> Message-ID: <45CC7693.6040502@simplistix.co.uk> Philipp von Weitershausen wrote: >>> Why would you want to get hold of the site root? Assuming that the >>> CMF tools are registered as local utilities, you should simply be >>> able to say: >>> from zope.component import getUtility >>> from Products.CMFPlone.interfaces import IPloneTool # verify this >>> plone_tool = getUtility(IPloneTool) >>> Zope will automatically figure out that where it should get that tool >>> from (because it traversed over the site). >> >> Really? That feels a bit DWIM :-( > > Yes. Do you see that as a good or a bad thing? >> I thought you had to pass in a context to get local utilities? > > No. That's the point, the context is found during traversal and other > code doesn't have to be aware of the context. In fact, why would code > *care* where the utility is from? All it wants is a utility, be it local > or global. Well, I'd imagine if you went to the trouble of registering local utilities, you did so for a reason? If that's the case, then how do I make sure the right utilities are used when I'm traversing around several objects in different locations in the same piece of code? I guess I'm interested in what couldn't as "traversed over" and how I can, if I need to, override where "Zope" thinks I've been traversing... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Fri Feb 9 14:36:39 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Fri, 9 Feb 2007 14:36:39 +0100 Subject: [z3-five] Plone Tool without acquisition In-Reply-To: <45CC7693.6040502@simplistix.co.uk> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAE0D7.1000800@simplistix.co.uk> <45CC7693.6040502@simplistix.co.uk> Message-ID: On 9 Feb 2007, at 14:26 , Chris Withers wrote: > Philipp von Weitershausen wrote: >>>> Why would you want to get hold of the site root? Assuming that >>>> the CMF tools are registered as local utilities, you should >>>> simply be able to say: >>>> from zope.component import getUtility >>>> from Products.CMFPlone.interfaces import IPloneTool # verify >>>> this >>>> plone_tool = getUtility(IPloneTool) >>>> Zope will automatically figure out that where it should get that >>>> tool from (because it traversed over the site). >>> >>> Really? That feels a bit DWIM :-( >> Yes. > > Do you see that as a good or a bad thing? The yes was for the "really". If you don't believe me, read the chapter on Sites in my book. It's all explained in detail there. IMO not having to specify a context is a good thing. Sometimes code doesnt' have access to a context, but it still wants to lookup a utility. Should it not be possible to let that utility come from a local component registry? I as the one who makes up application policy should be able to say where that utility comes from. >>> I thought you had to pass in a context to get local utilities? >> No. That's the point, the context is found during traversal and >> other code doesn't have to be aware of the context. In fact, why >> would code *care* where the utility is from? All it wants is a >> utility, be it local or global. > > Well, I'd imagine if you went to the trouble of registering local > utilities, you did so for a reason? You're missing the point. The code that's looking up the utility might be some completely different piece of software than the piece of code that provides the utility. Where that utility is registered is an implementation detail of the utility in the end. The code looking up the utility just wants to get an ISomething, no matter where it's from. > If that's the case, then how do I make sure the right utilities are > used when I'm traversing around several objects in different > locations in the same piece of code? There's only one kind of traversal -- URL traversal -- and it only happens once per request. The other thing sometimes referred to as "traversal" is resolving object graphs. That doesnt' trigger the site remembering code. > I guess I'm interested in what couldn't as "traversed over" and how > I can, if I need to, override where "Zope" thinks I've been > traversing... I don't think there's anything to worry about. From d.w.morriss at gmail.com Fri Feb 9 16:44:18 2007 From: d.w.morriss at gmail.com (whit) Date: Fri, 09 Feb 2007 09:44:18 -0600 Subject: [z3-five] Marker interfaces in Five 1.0.2 In-Reply-To: <45D61439174DCEDEBA4C3543@vg180585.grp.haufemg.com> References: <45D61439174DCEDEBA4C3543@vg180585.grp.haufemg.com> Message-ID: <45CC96D2.8090005@gmail.com> Andreas Jung wrote: > Hi, > > don't stone me to death but is there a way to attach marker interfaces > of objects in Five 1.0.2? > > Andreas > does this not work? from zope.interface import directlyProvidedBy from zope.interface import directlyProvides def mark(ob, interface): directlyProvides(ob, directlyProvidedBy(ob), interface) -w -- ------ d. whit morriss ------ - senior engineer, opencore - - http://www.openplans.org - - m: 415-710-8975 - "If you don't know where you are, you don't know anything at all" Dr. Edgar Spencer, Ph.D., 1995 From philipp at weitershausen.de Fri Feb 9 21:42:54 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Fri, 09 Feb 2007 21:42:54 +0100 Subject: [z3-five] Marker interfaces in Five 1.0.2 In-Reply-To: <45CC96D2.8090005@gmail.com> References: <45D61439174DCEDEBA4C3543@vg180585.grp.haufemg.com> <45CC96D2.8090005@gmail.com> Message-ID: <45CCDCCE.4050708@weitershausen.de> whit wrote: > Andreas Jung wrote: >> Hi, >> >> don't stone me to death but is there a way to attach marker interfaces >> of objects in Five 1.0.2? >> >> Andreas >> > > does this not work? > > from zope.interface import directlyProvidedBy > from zope.interface import directlyProvides > > def mark(ob, interface): > directlyProvides(ob, directlyProvidedBy(ob), interface) Actually, you probably might want to stick the marker interfaces to the beginning: def mark(ob, *interfaces): directlyProvides(ob, *interfaces, directlyProvidedBy(ob)) Since Zope 3.2 this function is part of the zope.interface package and called "alsoProvides". -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From d.w.morriss at gmail.com Fri Feb 9 23:31:56 2007 From: d.w.morriss at gmail.com (whit) Date: Fri, 09 Feb 2007 16:31:56 -0600 Subject: [z3-five] Marker interfaces in Five 1.0.2 In-Reply-To: <45CCDCCE.4050708@weitershausen.de> References: <45D61439174DCEDEBA4C3543@vg180585.grp.haufemg.com> <45CC96D2.8090005@gmail.com> <45CCDCCE.4050708@weitershausen.de> Message-ID: <45CCF65C.4020404@gmail.com> Philipp von Weitershausen wrote: > whit wrote: >> Andreas Jung wrote: >>> Hi, >>> >>> don't stone me to death but is there a way to attach marker interfaces >>> of objects in Five 1.0.2? >>> >>> Andreas >>> >> does this not work? >> >> from zope.interface import directlyProvidedBy >> from zope.interface import directlyProvides >> >> def mark(ob, interface): >> directlyProvides(ob, directlyProvidedBy(ob), interface) > > Actually, you probably might want to stick the marker interfaces to the > beginning: > > def mark(ob, *interfaces): > directlyProvides(ob, *interfaces, directlyProvidedBy(ob)) > > Since Zope 3.2 this function is part of the zope.interface package and > called "alsoProvides". > > yup... otherwise the other interfaces will resolve first. -w -- ------ d. whit morriss ------ - senior engineer, opencore - - http://www.openplans.org - - m: 415-710-8975 - "If you don't know where you are, you don't know anything at all" Dr. Edgar Spencer, Ph.D., 1995 From chris at simplistix.co.uk Mon Feb 12 18:21:38 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 12 Feb 2007 17:21:38 +0000 Subject: [z3-five] context-based utility lookup In-Reply-To: References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAE0D7.1000800@simplistix.co.uk> <45CC7693.6040502@simplistix.co.uk> Message-ID: <45D0A222.8030104@simplistix.co.uk> Philipp von Weitershausen wrote: >> Do you see that as a good or a bad thing? > > The yes was for the "really". If you don't believe me, read the chapter > on Sites in my book. It's all explained in detail there. Ah, okay, haven't got to that section in the 2nd Ed yet ;-) > IMO not having to specify a context is a good thing. Sometimes code > doesnt' have access to a context, but it still wants to lookup a > utility. Should it not be possible to let that utility come from a local > component registry? I as the one who makes up application policy should > be able to say where that utility comes from. Indeed, but can you override the context that gets used to figure out what utility gets picked up? >> Well, I'd imagine if you went to the trouble of registering local >> utilities, you did so for a reason? > > You're missing the point. The code that's looking up the utility might > be some completely different piece of software than the piece of code > that provides the utility. No, I understand that. >> If that's the case, then how do I make sure the right utilities are >> used when I'm traversing around several objects in different locations >> in the same piece of code? > > There's only one kind of traversal -- URL traversal -- and it only > happens once per request. Ah, okay. I suspect I'm going to learn lots more about this when I come to refactoring the publications stuff... > The other thing sometimes referred to as > "traversal" is resolving object graphs. That doesnt' trigger the site > remembering code. Good ;-) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Tue Feb 13 00:59:03 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 13 Feb 2007 00:59:03 +0100 Subject: [z3-five] context-based utility lookup In-Reply-To: <45D0A222.8030104@simplistix.co.uk> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAE0D7.1000800@simplistix.co.uk> <45CC7693.6040502@simplistix.co.uk> <45D0A222.8030104@simplistix.co.uk> Message-ID: <7889AC38-27CD-4AFE-918F-A5644CD77073@weitershausen.de> On 12 Feb 2007, at 18:21 , Chris Withers wrote: >> IMO not having to specify a context is a good thing. Sometimes >> code doesnt' have access to a context, but it still wants to >> lookup a utility. Should it not be possible to let that utility >> come from a local component registry? I as the one who makes up >> application policy should be able to say where that utility comes >> from. > > Indeed, but can you override the context that gets used to figure > out what utility gets picked up? Yes, you can always pass in a context explicitly in which case the closest site to that context will be used for the lookup. >>> If that's the case, then how do I make sure the right utilities >>> are used when I'm traversing around several objects in different >>> locations in the same piece of code? >> There's only one kind of traversal -- URL traversal -- and it only >> happens once per request. > > Ah, okay. I suspect I'm going to learn lots more about this when I > come to refactoring the publications stuff... Actually, the publication is quite agnostic of sites, fortunately. All the publication does is send out an IBeforeTraverseEvent for each object it is about to traverse. zope.app.component has a subscriber for that event on ISites that "remembers" the site in a thread local. In Zope 2, it works similarly, except that there's no publication that sends this event. Currently, we install a BeforeTraversalHook (something that the ZPublisher allows us to do) on an object-per- object basis; this hook sends the event (and then the same subscriber as in Zope 3 picks it up). This I'd actually like to change for Zope 2.11 so that we get before traverse events for all objects and don't have to install hooks on persistent objects anymore. From chris at simplistix.co.uk Tue Feb 13 09:14:49 2007 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 13 Feb 2007 08:14:49 +0000 Subject: [z3-five] context-based utility lookup In-Reply-To: <7889AC38-27CD-4AFE-918F-A5644CD77073@weitershausen.de> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAE0D7.1000800@simplistix.co.uk> <45CC7693.6040502@simplistix.co.uk> <45D0A222.8030104@simplistix.co.uk> <7889AC38-27CD-4AFE-918F-A5644CD77073@weitershausen.de> Message-ID: <45D17379.5020701@simplistix.co.uk> Philipp von Weitershausen wrote: >> Indeed, but can you override the context that gets used to figure out >> what utility gets picked up? > > Yes, you can always pass in a context explicitly in which case the > closest site to that context will be used for the lookup. Good stuff :-) Out of curiosity, is it acquisition or __parent__ that's used to find the "closest" site? > Actually, the publication is quite agnostic of sites, fortunately. All > the publication does is send out an IBeforeTraverseEvent for each object > it is about to traverse. zope.app.component has a subscriber for that > event on ISites that "remembers" the site in a thread local. Hmm, that brings me to another minor bug bear: I hadto step through the event process a week or so ago in pdb and was pretty horrified as to how many function calls were involved from the time event.notify() got called to when my event subscriber code was actually called. Not only does it make pdb'ing a pain, but I also wonder how much of a performance hurt that's going to be in a high volume application with a lot of events being fired? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Tue Feb 13 09:28:21 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 13 Feb 2007 09:28:21 +0100 Subject: [z3-five] context-based utility lookup In-Reply-To: <45D17379.5020701@simplistix.co.uk> References: <45CA5E64.4040801@gmx.net> <45CA7DDC.1080107@weitershausen.de> <45CAE0D7.1000800@simplistix.co.uk> <45CC7693.6040502@simplistix.co.uk> <45D0A222.8030104@simplistix.co.uk> <7889AC38-27CD-4AFE-918F-A5644CD77073@weitershausen.de> <45D17379.5020701@simplistix.co.uk> Message-ID: On 13 Feb 2007, at 09:14 , Chris Withers wrote: > Philipp von Weitershausen wrote: >>> Indeed, but can you override the context that gets used to figure >>> out what utility gets picked up? >> Yes, you can always pass in a context explicitly in which case the >> closest site to that context will be used for the lookup. > > Good stuff :-) > > Out of curiosity, is it acquisition or __parent__ that's used to > find the "closest" site? Lacking acquisition, Zope 3 uses __parent__. In Zope 2 we use aq_parent if there's no __parent__. >> Actually, the publication is quite agnostic of sites, fortunately. >> All the publication does is send out an IBeforeTraverseEvent for >> each object it is about to traverse. zope.app.component has a >> subscriber for that event on ISites that "remembers" the site in a >> thread local. > > Hmm, that brings me to another minor bug bear: I hadto step through > the event process a week or so ago in pdb and was pretty horrified > as to how many function calls were involved from the time > event.notify() got called to when my event subscriber code was > actually called. For a standard event it's 2 functions before your subscriber gets called: 1. zope.event.notify 2. zope.component.event.dispatch For an object event there's a third: 3. zope.component.event.objectEventNotify I guess it depends on one's point of view if that's "many" or not. > Not only does it make pdb'ing a pain, but I also wonder how much of > a performance hurt that's going to be in a high volume application > with a lot of events being fired? Well, if you wonder, I suggest some profiling. I'd be surprised if this were actually a big performance problem, but there's only one way to find that out for sure. As for pdb'ing, I cannot exactly recommend stepping through zope.component lookup calls. I've found it more effective to query the component registries for their registrations (getSiteManager ().registeredAdapters(), registeredUtilities(), etc.). This typically reveals the problem much quicker, without getting lost in the (sometimes optimized and therefore inscrutable) CA code. The only thing I'm missing there is a set of filters that one can apply when querying the registries, though those shouldn't be too hard to write. From maciej.wisniowski at coig.katowice.pl Thu Feb 15 23:57:43 2007 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Thu, 15 Feb 2007 23:57:43 +0100 Subject: [z3-five] Formlib custom template - AttributeError: debug. Message-ID: <45D4E567.7030005@coig.katowice.pl> Hi I want to create custom template for Formlib based form. My code is at the bottom of this post. Zope 2.9.6, Five 1.4.2 In general I tried to define template with: template = namedtemplate.NamedTemplate('mytemp') template = ViewPageTemplateFile('mytemp.pt') In both cases, when I try to visit @@mypage.html I get: Traceback (innermost last): Module ZPublisher.Publish, line 115, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 41, in call_object Module zope.formlib.form, line 758, in __call__ Module zope.formlib.form, line 752, in render Module zope.app.pagetemplate.viewpagetemplatefile, line 83, in __call__ Module zope.app.pagetemplate.viewpagetemplatefile, line 47, in __call__ Module ZPublisher.HTTPRequest, line 1219, in __getattr__ AttributeError: debug mytemp.pt is basically a copy of pageform.pt from formlib. Without custom template assignment everything works. What is wrong? Code is run at Plone but it's plain five with formlib here. Possibly lack of acquisition wrapper? File: browser/views.py: ----------------------- from zope.app.i18n import ZopeMessageFactory as _ from zope.formlib import form from Products.Five.formlib import formbase from Products.myproduct import interfaces from zope.app.pagetemplate import ViewPageTemplateFile from zope.formlib import namedtemplate from zope.formlib import interfaces as form_interfaces class StartForm(formbase.EditForm): form_fields = form.FormFields(interfaces.IInter).select('blablabla') template = namedtemplate.NamedTemplate('mytemp') # option 1 #template = ViewPageTemplateFile('mytemp.pt') # option 2 def __init__(self, *args, **kwargs): formbase.EditForm.__init__(self, *args, **kwargs) mytemp_page_template = namedtemplate.NamedTemplateImplementation( ViewPageTemplateFile('mytemp.pt'), form_interfaces.IPageForm) File: browser/configure.zcml: ---------------------------- -- Maciej Wisniowski From tim at sitefusion.co.uk Fri Feb 16 00:35:21 2007 From: tim at sitefusion.co.uk (Tim Hicks) Date: Thu, 15 Feb 2007 23:35:21 +0000 Subject: [z3-five] Formlib custom template - AttributeError: debug. In-Reply-To: <45D4E567.7030005@coig.katowice.pl> References: <45D4E567.7030005@coig.katowice.pl> Message-ID: <45D4EE39.6090307@sitefusion.co.uk> Maciej Wisniowski wrote: > Hi > > I want to create custom template for Formlib based form. > My code is at the bottom of this post. Zope 2.9.6, Five 1.4.2 > In general I tried to define template with: > > template = namedtemplate.NamedTemplate('mytemp') > template = ViewPageTemplateFile('mytemp.pt') I managed to get things working by using the following: from Products.Five.browser import pagetemplatefile from plone.app.form._named import named_template_adapter _template = pagetemplatefile.ViewPageTemplateFile('pageform.pt') default_named_template_adapter = named_template_adapter(_template) Not sure if it's the "right" way of doing it, but it works for me. hth, Tim From optilude at gmx.net Fri Feb 16 02:28:24 2007 From: optilude at gmx.net (Martin Aspeli) Date: Fri, 16 Feb 2007 01:28:24 +0000 Subject: [z3-five] Is browser:addMenuItem and addingInfo() supposed to work? Message-ID: Hi, I've seen reports of people making this work, but I'm struggling. I've got an add view (formlib AddForm) and an add menu item like so: I then want to list all addable views (in fact, I'm trying to make Plone respect add-menus and ultimately add forms, at least in the case where an add menu item can be linked to an old-fashioned CMF). However, I get ComponentLookupErrors, because adding.py in Five does this: def addingInfo(self): """Return menu data. This is sorted by title. """ container = self.context result = [] for menu_id in (self.menu_id, 'zope.app.container.add'): if not menu_id: continue for item in getMenu(menu_id, self, self.request): extra = item.get('extra') if extra: factory = extra.get('factory') if factory: factory = zope.component.getUtility(IFactory, factory) if not checkFactory(container, None, factory): continue elif item['extra']['factory'] != item['action']: item['has_custom_add_view']=True result.append(item) result.sort(lambda a, b: cmp(a['title'], b['title'])) return result self.menu_id is from here: class ContentAdding(Adding, SimpleItem): menu_id = "add_content" Now, neither add_content nor zope.app.container.add is registered anywhere (Products.Five or zope.*) that I can see. The latter is provided in a test in zope.app.publisher. The former is nowhere to be found. Unless I provide both, I can't see how this won't fail every time. I can add some registrations in Plone, or send patch to Five if we can get it in time for Plone 3. Martin From tim at se.linux.org Fri Feb 16 12:06:35 2007 From: tim at se.linux.org (Tim =?iso-8859-1?Q?Terleg=E5rd?=) Date: Fri, 16 Feb 2007 12:06:35 +0100 Subject: [z3-five] Formlib custom template - AttributeError: debug. In-Reply-To: <45D4E567.7030005@coig.katowice.pl> References: <45D4E567.7030005@coig.katowice.pl> Message-ID: <20070216110635.GA18351@kraftur.se.linux.org> > Traceback (innermost last): > Module ZPublisher.Publish, line 115, in publish > Module ZPublisher.mapply, line 88, in mapply > Module ZPublisher.Publish, line 41, in call_object > Module zope.formlib.form, line 758, in __call__ > Module zope.formlib.form, line 752, in render > Module zope.app.pagetemplate.viewpagetemplatefile, line 83, in __call__ > Module zope.app.pagetemplate.viewpagetemplatefile, line 47, in __call__ > Module ZPublisher.HTTPRequest, line 1219, in __getattr__ > AttributeError: debug I got this yesterday as well. Zope 3 requests has a debug attribute, but Zope 2 requests have not. So there's a problem when Zope 3 code uses the Zope 2 request and expects there to be a debug attribute. I fixed this by adding the debug attribute to the ZPlublisher.HTTPRequest class inside __init__: from zope.publisher.base import DebugFlags self.debug = DebugFlags() # inside __init__ Philipp said it will be fixed in Zope 2.11 or something. But there's no way we can wait that long to get our stuff working :) Tim From maciej.wisniowski at coig.katowice.pl Fri Feb 16 12:26:17 2007 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Fri, 16 Feb 2007 12:26:17 +0100 Subject: [z3-five] Formlib custom template - AttributeError: debug. In-Reply-To: <20070216110635.GA18351@kraftur.se.linux.org> References: <45D4E567.7030005@coig.katowice.pl> <20070216110635.GA18351@kraftur.se.linux.org> Message-ID: <45D594D9.1080202@coig.katowice.pl> > I got this yesterday as well. Zope 3 requests has a debug attribute, but > Zope 2 requests have not. So there's a problem when Zope 3 code uses the > Zope 2 request and expects there to be a debug attribute. > > I fixed this by adding the debug attribute to the ZPlublisher.HTTPRequest > class inside __init__: > > from zope.publisher.base import DebugFlags > self.debug = DebugFlags() # inside __init__ > > Philipp said it will be fixed in Zope 2.11 or something. But there's no > way we can wait that long to get our stuff working :) > Good to know but I wonder how default formlib form works then? It also uses NamedTemplates and rest of the stuff just like I used in my form. Where is the point that original formlib 'pageform.pt' doesn't raise this error? I didn't find anything about 'debug' in formlib code (but maybe I missed something)? -- Maciej Wisniowski From maciej.wisniowski at coig.katowice.pl Fri Feb 16 12:30:46 2007 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Fri, 16 Feb 2007 12:30:46 +0100 Subject: [z3-five] Formlib custom template - AttributeError: debug. In-Reply-To: <45D4EE39.6090307@sitefusion.co.uk> References: <45D4E567.7030005@coig.katowice.pl> <45D4EE39.6090307@sitefusion.co.uk> Message-ID: <45D595E6.6040208@coig.katowice.pl> > > I managed to get things working by using the following: > > from Products.Five.browser import pagetemplatefile > from plone.app.form._named import named_template_adapter > _template = pagetemplatefile.ViewPageTemplateFile('pageform.pt') > default_named_template_adapter = named_template_adapter(_template) > Huh... I've even seen named_template_adapter code in plone core before but was not sure how to use this. Thanks -- Maciej Wisniowski From tim at se.linux.org Fri Feb 16 12:34:33 2007 From: tim at se.linux.org (Tim =?iso-8859-1?Q?Terleg=E5rd?=) Date: Fri, 16 Feb 2007 12:34:33 +0100 Subject: [z3-five] traversing path expression Message-ID: <20070216113433.GB18351@kraftur.se.linux.org> Hi, I'm trying to use Five and plone.app.form to get an automatic edit form which uses zope.formlib. There seems to be a problem with traversal of the path expressions in the template. I get back None for the 'view/xxx' expression for any value of xxx. The OrderedMultiSelectWidget (orderedSelectionList.pt) is used for showing my List field. After debugging the widget, tal etc I finally came to the part where traversing apapters are used for finding 'xxx' of the view. The widget (which is the view) is adapted to ITraversable in zope.app.traversing.adapers.py. It finds Five.traversable.FiveTraversable which doesn't look for the 'xxx' attribute, it just looks for an adapter with the name 'xxx'. It can't find one and the traversing returns None and so does the path expression. FiveTraversable inherits from DefaultTraversable which seems to look at the attribute, but FiveTraversable overrides the traverse method with code that doesn't consider the attributes, it only search for an adapter. I'm very confused. Am I missing some five zcml directives or why can't my path expression be traversed correctly? I'm using Five 1.4,2. Tim From tim at se.linux.org Fri Feb 16 15:42:37 2007 From: tim at se.linux.org (Tim =?iso-8859-1?Q?Terleg=E5rd?=) Date: Fri, 16 Feb 2007 15:42:37 +0100 Subject: [z3-five] traversing path expression In-Reply-To: <20070216113433.GB18351@kraftur.se.linux.org> References: <20070216113433.GB18351@kraftur.se.linux.org> Message-ID: <20070216144237.GC18351@kraftur.se.linux.org> On Fri, Feb 16, 2007 at 12:34:33PM +0100, Tim Terleg?rd wrote: > > I'm trying to use Five and plone.app.form to get an automatic edit form > which uses zope.formlib. There seems to be a problem with traversal of the > path expressions in the template. I get back None for the 'view/xxx' > expression for any value of xxx. > > The OrderedMultiSelectWidget (orderedSelectionList.pt) is used for showing > my List field. After debugging the widget, tal etc I finally came to the > part where traversing apapters are used for finding 'xxx' of the view. The > widget (which is the view) is adapted to ITraversable in > zope.app.traversing.adapers.py. It finds Five.traversable.FiveTraversable > which doesn't look for the 'xxx' attribute, it just looks for an adapter > with the name 'xxx'. It can't find one and the traversing returns None > and so does the path expression. > > FiveTraversable inherits from DefaultTraversable which seems to look at > the attribute, but FiveTraversable overrides the traverse method with > code that doesn't consider the attributes, it only search for an adapter. This workaround worked. It seems that the widget I use (OrderedMultiSelectWidget) renders itself and it therefore uses zope3 page template engine, which is not fully compatible with zope2 (atleast when it comes to path expression traversing). So problem solved. Tim From maciej.wisniowski at coig.katowice.pl Fri Feb 16 22:37:17 2007 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Fri, 16 Feb 2007 22:37:17 +0100 Subject: [z3-five] Formlib custom template - AttributeError: debug. In-Reply-To: <45D4E567.7030005@coig.katowice.pl> References: <45D4E567.7030005@coig.katowice.pl> Message-ID: <45D6240D.9010600@coig.katowice.pl> > What is wrong? Code is run at Plone but it's plain five with > formlib here. Possibly lack of acquisition wrapper? I found the bug. In general I looked at lib/python/zope/formlib instead of Products/Five/formlib. ViewPageTemplateFile should be imported like: from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile not like: from zope.app.pagetemplate import ViewPageTemplateFile. Also template definition (pageform.pt) is (re)defined in Five package. -- Maciej Wisniowski From d.schulz81 at gmx.net Sat Feb 17 17:32:13 2007 From: d.schulz81 at gmx.net (Dennis Schulz) Date: Sat, 17 Feb 2007 17:32:13 +0100 Subject: [z3-five] view on several permissions? Message-ID: <45D72E0D.90402@gmx.net> Hi, is it possible to register a view on several permissions in zcml? I tried the following notations but didn't work: permission="cmf.ListFolderContents; cells.pr.approve" permission="cmf.ListFolderContents, cells.pr.approve" What is the proper way of doing this? Do I have to register the view two times? Cheers, Dennis From philipp at weitershausen.de Sun Feb 18 12:57:11 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Sun, 18 Feb 2007 12:57:11 +0100 Subject: [z3-five] view on several permissions? In-Reply-To: <45D72E0D.90402@gmx.net> References: <45D72E0D.90402@gmx.net> Message-ID: <45D83F17.90102@weitershausen.de> Dennis Schulz wrote: > is it possible to register a view on several permissions in zcml? > I tried the following notations but didn't work: > > permission="cmf.ListFolderContents; cells.pr.approve" > permission="cmf.ListFolderContents, cells.pr.approve" > > What is the proper way of doing this? > Do I have to register the view two times? Anything, including a view, can only have one unique permission. That's how Zope's security system works. You will have to make up your mind and decide which permission to protect the view with. -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From philipp at weitershausen.de Sun Feb 18 13:04:39 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Sun, 18 Feb 2007 13:04:39 +0100 Subject: [z3-five] Is browser:addMenuItem and addingInfo() supposed to work? In-Reply-To: References: Message-ID: <45D840D7.4000002@weitershausen.de> Martin Aspeli wrote: > I've seen reports of people making this work, but I'm struggling. I've > got an add view (formlib AddForm) and an add menu item like so: > > title="Foo" > factory="my.package.Foo" > view="my.package.Foo" > permission="cmf.AddPortalContent" > /> > > I then want to list all addable views (in fact, I'm trying to make Plone > respect add-menus and ultimately add forms, at least in the case where > an add menu item can be linked to an old-fashioned CMF). > > However, I get ComponentLookupErrors, because adding.py in Five does this: [snip] Next time, I suggest you paste the error traceback, because that's way more informative than a code snippet from Five that everybody can lookup by himself. Right now I had to guess what component it failed to lookup... > Now, neither add_content nor zope.app.container.add is registered > anywhere (Products.Five or zope.*) that I can see. It's registered in zope.app/menus.zcml. This file is probably not available in Zope 2 (anymore): > The latter is > provided in a test in zope.app.publisher. The former is nowhere to be > found. Unless I provide both, I can't see how this won't fail every time. add_content is old and no longer used in Zope 3. *Sigh*. This is *exactly* why I want to get rid of all of this useless code duplication in Five. > I can add some registrations in Plone, or send patch to Five if we can > get it in time for Plone 3. For now I suggest you guys register zope.app.container.add yourself. Or, perhaps you register a variant and also regsiter your own adding view that refers to your variant. -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From optilude at gmx.net Sun Feb 18 13:12:56 2007 From: optilude at gmx.net (Martin Aspeli) Date: Sun, 18 Feb 2007 12:12:56 +0000 Subject: [z3-five] Is browser:addMenuItem and addingInfo() supposed to work? In-Reply-To: <45D840D7.4000002@weitershausen.de> References: <45D840D7.4000002@weitershausen.de> Message-ID: Philipp von Weitershausen wrote: > Martin Aspeli wrote: >> I've seen reports of people making this work, but I'm struggling. I've >> got an add view (formlib AddForm) and an add menu item like so: >> >> > title="Foo" >> factory="my.package.Foo" >> view="my.package.Foo" >> permission="cmf.AddPortalContent" >> /> >> >> I then want to list all addable views (in fact, I'm trying to make Plone >> respect add-menus and ultimately add forms, at least in the case where >> an add menu item can be linked to an old-fashioned CMF). >> >> However, I get ComponentLookupErrors, because adding.py in Five does this: > [snip] > > Next time, I suggest you paste the error traceback, because that's way > more informative than a code snippet from Five that everybody can lookup > by himself. Right now I had to guess what component it failed to lookup... Yeah, sorry, was being lazy. The error is looking up the utility for the IBrowserMenu. >> Now, neither add_content nor zope.app.container.add is registered >> anywhere (Products.Five or zope.*) that I can see. > > It's registered in zope.app/menus.zcml. This file is probably not > available in Zope 2 (anymore): > > id="zope.app.container.add" > title="Add" > description="Menu for objects to be added according to > containment constraints" > interface="zope.app.publisher.interfaces.browser.AddMenu" > /> > >> The latter is >> provided in a test in zope.app.publisher. The former is nowhere to be >> found. Unless I provide both, I can't see how this won't fail every time. > > add_content is old and no longer used in Zope 3. > > *Sigh*. This is *exactly* why I want to get rid of all of this useless > code duplication in Five. :) >> I can add some registrations in Plone, or send patch to Five if we can >> get it in time for Plone 3. > > For now I suggest you guys register zope.app.container.add yourself. Or, > perhaps you register a variant and also regsiter your own adding view > that refers to your variant. Actually, I think it can't work anyway, because it first tries to look for "add_content" which isn't registered anywhere either. We made it work by looking up items registered for the zope.app.publisher.interfaces.browser.AddMenu directly, i.e. not by name. The directive falls back on this interface. Martin From optilude at gmx.net Sat Feb 24 04:19:20 2007 From: optilude at gmx.net (Martin Aspeli) Date: Sat, 24 Feb 2007 03:19:20 +0000 Subject: [z3-five] FieldProperty, acquisition and Zope 2 Message-ID: Hi all, I was using FieldProperty in something like this: class ITask(Interface): assigned_to = schema.Choice(title=_(u"Assigned to"), vocabulary="assignees") The assignees vocabulary is defined as such: def assigneeVocabularyFactory(context): """Get possible assignees from the immediate parent project """ team = () parent = context while parent is not None and not team: project = IProject(parent, None) if project is not None: team = project.team else: parent = aq_parent(parent) return SimpleVocabulary.fromValues(team) alsoProvides(assigneeVocabularyFactory, IVocabularyFactory) I then have a class which uses a FieldProperty: class Task(SimpleItem): implements(ITask) assigned_to = FieldProperty(IDeliverable['assigned_to']) I've got an add form which uses form.applyChanges(task, self.form_fields, data) Now, this fails horribly, miserably and deep-deep inside zope.schema or thereabouts. To be honest, the traceback is pretty useless, but I've worked out that the error occurs because FieldProperty is a property, with __get__() and __set__() methods, and as soon as I go there, the task loses its acquisition context. Now, http://zope.org/Collectors/Zope/2163 tells me that we can't have acquisition inside property accessors. I'm wondering, though, if we have other options? Could Five provide something similar to FieldProperty but which is acquisition-aware? Martin From philipp at weitershausen.de Sat Feb 24 12:04:49 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Sat, 24 Feb 2007 12:04:49 +0100 Subject: [z3-five] FieldProperty, acquisition and Zope 2 In-Reply-To: References: Message-ID: <45E01BD1.1030404@weitershausen.de> Martin Aspeli wrote: > Now, this fails horribly, miserably and deep-deep inside zope.schema or > thereabouts. To be honest, the traceback is pretty useless, but I've > worked out that the error occurs because FieldProperty is a property, > with __get__() and __set__() methods, and as soon as I go there, the > task loses its acquisition context. > > Now, http://zope.org/Collectors/Zope/2163 tells me that we can't have > acquisition inside property accessors. > > I'm wondering, though, if we have other options? Could Five provide > something similar to FieldProperty but which is acquisition-aware? Unlikely. I find FieldProperty is YAGNI most of the time. You describe that you're using formlib forms to apply the data to the object. Formlib does all the validation already. Why do you need FieldProperty? -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From optilude at gmx.net Sat Feb 24 13:12:14 2007 From: optilude at gmx.net (Martin Aspeli) Date: Sat, 24 Feb 2007 12:12:14 +0000 Subject: [z3-five] FieldProperty, acquisition and Zope 2 In-Reply-To: <45E01BD1.1030404@weitershausen.de> References: <45E01BD1.1030404@weitershausen.de> Message-ID: Philipp von Weitershausen wrote: > Martin Aspeli wrote: >> Now, this fails horribly, miserably and deep-deep inside zope.schema or >> thereabouts. To be honest, the traceback is pretty useless, but I've >> worked out that the error occurs because FieldProperty is a property, >> with __get__() and __set__() methods, and as soon as I go there, the >> task loses its acquisition context. >> >> Now, http://zope.org/Collectors/Zope/2163 tells me that we can't have >> acquisition inside property accessors. >> >> I'm wondering, though, if we have other options? Could Five provide >> something similar to FieldProperty but which is acquisition-aware? > > Unlikely. I find FieldProperty is YAGNI most of the time. You describe > that you're using formlib forms to apply the data to the object. Formlib > does all the validation already. Why do you need FieldProperty? Hey, I learned about them from *your* book, you tell me. :-) I agree it's a bit YAGNI. :) Martin From rocky at serverzen.com Mon Mar 5 16:13:24 2007 From: rocky at serverzen.com (Rocky) Date: Mon, 05 Mar 2007 07:13:24 -0800 Subject: [z3-five] first public five.localsitemanager release Message-ID: <1173107604.363714.229090@30g2000cwc.googlegroups.com> Just wanted to let you all know that I've just published the first public five.localsitemanager release to the cheeseshop. You can find it's info at: http://cheeseshop.python.org/pypi/five.localsitemanager/ This should probably mean that the Five/site stuff in Products.Five in zope2 svn trunk should be deprecated. The one additional feature I'd personally like to see before 1.0 final is a full management screen located at mysite/++etc++site that would allow one to register/unregister components. Right now that traversal does exist but it basically just points to the ObjectManager zmi screens for the component registry. If anyone else has any feature requests, be sure to post them. Regards, Rocky From philipp at weitershausen.de Mon Mar 5 17:38:36 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Mon, 05 Mar 2007 11:38:36 -0500 Subject: [z3-five] first public five.localsitemanager release In-Reply-To: <1173107604.363714.229090@30g2000cwc.googlegroups.com> References: <1173107604.363714.229090@30g2000cwc.googlegroups.com> Message-ID: <45EC478C.5050805@weitershausen.de> Rocky wrote: > Just wanted to let you all know that I've just published the first > public five.localsitemanager release to the cheeseshop. You can find > it's info at: > http://cheeseshop.python.org/pypi/five.localsitemanager/ Yay, great stuff! > This should probably mean that the Five/site stuff in Products.Five in > zope2 svn trunk should be deprecated. At least it should be discouraged and five.localsitemanager should be encouraged at the same time. In a future version of Zope2/Five, we might give Five some long-awaited cleanup and ship five.localsitemanager with Zope 2 as a replacement. BBB will have to be maintained. > The one additional feature I'd personally like to see before 1.0 final > is a full management screen located at mysite/++etc++site that would > allow one to register/unregister components. Right now that traversal > does exist but it basically just points to the ObjectManager zmi > screens for the component registry. Sounds good. -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From lists at zopyx.com Mon Mar 5 17:47:40 2007 From: lists at zopyx.com (Andreas Jung) Date: Mon, 05 Mar 2007 17:47:40 +0100 Subject: [z3-five] first public five.localsitemanager release In-Reply-To: <1173107604.363714.229090@30g2000cwc.googlegroups.com> References: <1173107604.363714.229090@30g2000cwc.googlegroups.com> Message-ID: <51767FDE9E1C668F1E69397B@[192.168.0.24]> --On 5. M?rz 2007 07:13:24 -0800 Rocky wrote: > Just wanted to let you all know that I've just published the first > public five.localsitemanager release to the cheeseshop. You can find > it's info at: > http://cheeseshop.python.org/pypi/five.localsitemanager/ Nice. But I wonder why it has to be a dedicated project and isn't part of further Five releases? Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20070305/d46c751b/attachment.pgp From philipp at weitershausen.de Mon Mar 5 18:00:51 2007 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Mon, 05 Mar 2007 12:00:51 -0500 Subject: [z3-five] first public five.localsitemanager release In-Reply-To: <51767FDE9E1C668F1E69397B@[192.168.0.24]> References: <1173107604.363714.229090@30g2000cwc.googlegroups.com> <51767FDE9E1C668F1E69397B@[192.168.0.24]> Message-ID: <45EC4CC3.4080104@weitershausen.de> Andreas Jung wrote: >> Just wanted to let you all know that I've just published the first >> public five.localsitemanager release to the cheeseshop. You can find >> it's info at: >> http://cheeseshop.python.org/pypi/five.localsitemanager/ > > > Nice. But I wonder why it has to be a dedicated project and isn't part > of further Five releases? Because this is a new feature that we now want to use in Zope 2.10. Adding smaller packages, independently distributed packages that everybody can install if they want is much easier than maintaining a whole new Five release, telling people to install that, etc. I expect that much of Five will actually go away once we make some tiny but important changes in Zope 2 (make Acquisition aware of __parent__). -- http://worldcookery.com -- Professional Zope documentation and training Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5 From lists at zopyx.com Wed Mar 21 06:59:27 2007 From: lists at zopyx.com (Andreas Jung) Date: Wed, 21 Mar 2007 06:59:27 +0100 Subject: [z3-five] Programmatic initialization of utilites during the Zope startup phase Message-ID: <256A8DFABE9AD1ADDB5E2840@suxmac2.local> Hi, I have the need to register some utilities dynamically during the startup phase of Zope. In detail: I have a product that uses z3c.sqlalchemy (a Zope 3 database adapter for Zope2/3). During the startup I need to read some database configurations from a configuration file and setup a named utility for each of the database configurations. I can't and don't want to do that in ZCML. However the Zope product initialization happens before the Zope 3 registry stuff is available. I have a workaround with a setup utility registered through ZCML that performs the registration of the utilities after Zope is up and before answering to the first product specific request. This works but I consider this to be an ugly workaround. Any ideas for a better solution? Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20070321/27661cf9/attachment.pgp From sidnei at enfoldsystems.com Wed Mar 21 13:53:59 2007 From: sidnei at enfoldsystems.com (Sidnei da Silva) Date: Wed, 21 Mar 2007 09:53:59 -0300 Subject: [z3-five] Programmatic initialization of utilites during the Zope startup phase In-Reply-To: <256A8DFABE9AD1ADDB5E2840@suxmac2.local> References: <256A8DFABE9AD1ADDB5E2840@suxmac2.local> Message-ID: I had a similar issue here, and I was able to just add some code on the inside the initialize() method of my Zope product: from zope.interface import providedBy from zope.component import getGlobalSiteManager for iface in providedBy(utility): getGlobalSiteManager().provideUtility(iface, utility, u'') Are you saying that in your case the global site manager is not available yet by the time the product's initialize() is called? -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 From lists at zopyx.com Wed Mar 21 14:39:12 2007 From: lists at zopyx.com (Andreas Jung) Date: Wed, 21 Mar 2007 14:39:12 +0100 Subject: [z3-five] Programmatic initialization of utilites during the Zope startup phase In-Reply-To: References: <256A8DFABE9AD1ADDB5E2840@suxmac2.local> Message-ID: --On 21. M?rz 2007 09:53:59 -0300 Sidnei da Silva wrote: > I had a similar issue here, and I was able to just add some code on > the inside the initialize() method of my Zope product: > > from zope.interface import providedBy > from zope.component import getGlobalSiteManager > for iface in providedBy(utility): > getGlobalSiteManager().provideUtility(iface, utility, u'') > > Are you saying that in your case the global site manager is not > available yet by the time the product's initialize() is called? > We're still on Zope 2.8.something...I think I tried all that with the related APIs that are available in Zope 3.0. Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20070321/08d67ada/attachment.pgp From ra at burningman.com Fri Mar 23 02:16:28 2007 From: ra at burningman.com (Rob Miller) Date: Thu, 22 Mar 2007 18:16:28 -0700 Subject: [z3-five] weird ZEO cache error during five:registerPackage processing Message-ID: hi all, i've got a very strange problem happening. whenever i start my Zope server against a brand new ZODB being served up by ZEO, Zope dies while in the ZCML processing for a five:registerPackage call. here's the traceback: Traceback (most recent call last): File "/home/rob/openplans/lib/zope/lib/python/Zope2/Startup/run.py", line 56, in ? run() File "/home/rob/openplans/lib/zope/lib/python/Zope2/Startup/run.py", line 21, in run starter.prepare() File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/Zope2/Startup/__init__.py", line 98, in prepare self.startZope() File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/Zope2/Startup/__init__.py", line 257, in startZope Zope2.startup() File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/Zope2/__init__.py", line 47, in startup _startup() File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/Zope2/App/startup.py", line 103, in startup OFS.Application.initialize(application) File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/OFS/Application.py", line 304, in initialize initializer.initialize() File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/OFS/Application.py", line 333, in initialize self.install_products() File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/OFS/Application.py", line 605, in install_products return install_products(app) File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/OFS/Application.py", line 636, in install_products folder_permissions, raise_exc=debug_mode) File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/OFS/Application.py", line 783, in install_product initmethod(context) File "/home/rob/openplans/zope/Products/Five/__init__.py", line 31, in initialize zcml.load_site() File "/home/rob/openplans/zope/Products/Five/zcml.py", line 41, in load_site _context = xmlconfig.file(file) File "/home/rob/openplans/lib/zope/lib/python/zope/configuration/xmlconfig.py", line 559, in file context.execute_actions() File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/zope/configuration/config.py", line 612, in execute_actions callable(*args, **kw) File "/home/rob/openplans/zope/Products/Five/fiveconfigure.py", line 284, in _registerPackage transaction.commit() File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/transaction/_manager.py", line 96, in commit return self.get().commit(sub, deprecation_wng=False) File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/transaction/_transaction.py", line 380, in commit self._saveCommitishError() # This raises! File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/transaction/_transaction.py", line 378, in commit self._commitResources() File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/transaction/_transaction.py", line 441, in _commitResources rm.tpc_finish(self) File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/ZODB/Connection.py", line 679, in tpc_finish self._storage.tpc_finish(transaction, callback) File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/ZEO/ClientStorage.py", line 974, in tpc_finish self._update_cache(tid) File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/ZEO/ClientStorage.py", line 999, in _update_cache self._cache.invalidate(oid, version, tid) File "/home/rob/openplans/lib/Zope-2.9.6/lib/python/ZEO/cache.py", line 367, in invalidate assert tid is not None and cur_tid < tid zope.configuration.config.ConfigurationExecutionError: exceptions.AssertionError: in: File "/home/rob/openplans/src/opencore_trunk/opencore/siteui/configure.zcml", line 9.2-12.7 this is using Zope 2.9.6 and the Five 1.4 branch. the tag that is causing the problem can be found at http://tinyurl.com/yqoaw7. i've absolutely verified that the registerPackage directive is causing the problem; if i remove that tag Zope starts with no problem. similarly, if i don't use ZEO it starts w/o trouble. and subsequent starts, once there is a Data.fs file to connect to, also seem to work. it's only this one combination that causes the problem. it's a bit of a headache, though, b/c it means that our buildbot processes, which construct an environment from scratch every time, fail before they even begin. i know very little about the ZEO caching infrastructure, and don't even know where to being in debugging this. anyone have any clues what might be going on? -r From chrism at plope.com Fri Mar 23 03:09:45 2007 From: chrism at plope.com (Chris McDonough) Date: Thu, 22 Mar 2007 22:09:45 -0400 Subject: [z3-five] weird ZEO cache error during five:registerPackage processing In-Reply-To: References: Message-ID: This seems to be isolated to packages which are not in the Products namespace. Another person sent a similar bugreport to the Zope (or ZODB?) list. The problem seems to be that the registerPackage handler (in fiveconfigure.py) attempts to commit a transaction in the midst of a finally clause, which smells a little weird. If you comment the transaction.commit out in that directive, what happens? On Mar 22, 2007, at 9:16 PM, Rob Miller wrote: > registerPackage From chrism at plope.com Sat Mar 24 00:34:42 2007 From: chrism at plope.com (Chris McDonough) Date: Fri, 23 Mar 2007 19:34:42 -0400 Subject: [z3-five] weird ZEO cache error during five:registerPackage processing In-Reply-To: <4604620B.4050301@burningman.com> References: <4604620B.4050301@burningman.com> Message-ID: <265661DF-8DD5-4016-A68D-467F5E9DDF80@plope.com> On Mar 23, 2007, at 7:26 PM, Rob Miller wrote: > Chris McDonough wrote: >> This seems to be isolated to packages which are not in the >> Products namespace. Another person sent a similar bugreport to >> the Zope (or ZODB?) list. The problem seems to be that the >> registerPackage handler (in fiveconfigure.py) attempts to commit a >> transaction in the midst of a finally clause, which smells a >> little weird. If you comment the transaction.commit out in that >> directive, what happens? > > if i do that, then i get the same traceback as before, but every > time instead of just during the initial start. I think it's broke, mon. I think the utility of this directive might a little suspect to begin with (if you have a package that needs startup initialization, you could just put it in the Products namespace), but the only other thing I can think to try is to take all the exception handling out of this the fiveconfigure._registerPackage function and track down why it's barfing to start with. Sorry Rob. :-( From ra at burningman.com Sat Mar 24 01:04:09 2007 From: ra at burningman.com (Rob Miller) Date: Fri, 23 Mar 2007 17:04:09 -0700 Subject: [z3-five] weird ZEO cache error during five:registerPackage processing In-Reply-To: <265661DF-8DD5-4016-A68D-467F5E9DDF80@plope.com> References: <4604620B.4050301@burningman.com> <265661DF-8DD5-4016-A68D-467F5E9DDF80@plope.com> Message-ID: <46046AF9.7070704@burningman.com> Chris McDonough wrote: > On Mar 23, 2007, at 7:26 PM, Rob Miller wrote: > >> Chris McDonough wrote: >>> This seems to be isolated to packages which are not in the >>> Products namespace. Another person sent a similar bugreport to >>> the Zope (or ZODB?) list. The problem seems to be that the >>> registerPackage handler (in fiveconfigure.py) attempts to commit a >>> transaction in the midst of a finally clause, which smells a >>> little weird. If you comment the transaction.commit out in that >>> directive, what happens? >> if i do that, then i get the same traceback as before, but every >> time instead of just during the initial start. > > I think it's broke, mon. I think the utility of this directive might > a little suspect to begin with (if you have a package that needs > startup initialization, you could just put it in the Products > namespace), but the only other thing I can think to try is to take > all the exception handling out of this the > fiveconfigure._registerPackage function and track down why it's > barfing to start with. > > Sorry Rob. :-( 'saright. as you said, there's always the Products namespace. :-). -r From d.w.morriss at gmail.com Mon Mar 26 17:20:09 2007 From: d.w.morriss at gmail.com (whit) Date: Mon, 26 Mar 2007 10:20:09 -0500 Subject: [z3-five] weird ZEO cache error during five:registerPackage processing In-Reply-To: <46046AF9.7070704@burningman.com> References: <4604620B.4050301@burningman.com> <265661DF-8DD5-4016-A68D-467F5E9DDF80@plope.com> <46046AF9.7070704@burningman.com> Message-ID: Rob Miller wrote: > Chris McDonough wrote: >> On Mar 23, 2007, at 7:26 PM, Rob Miller wrote: >> >>> Chris McDonough wrote: >>>> This seems to be isolated to packages which are not in the >>>> Products namespace. Another person sent a similar bugreport to >>>> the Zope (or ZODB?) list. The problem seems to be that the >>>> registerPackage handler (in fiveconfigure.py) attempts to commit a >>>> transaction in the midst of a finally clause, which smells a >>>> little weird. If you comment the transaction.commit out in that >>>> directive, what happens? >>> if i do that, then i get the same traceback as before, but every >>> time instead of just during the initial start. >> I think it's broke, mon. I think the utility of this directive might >> a little suspect to begin with (if you have a package that needs >> startup initialization, you could just put it in the Products >> namespace), but the only other thing I can think to try is to take >> all the exception handling out of this the >> fiveconfigure._registerPackage function and track down why it's >> barfing to start with. >> >> Sorry Rob. :-( > > 'saright. as you said, there's always the Products namespace. :-). > > -r > rocky? -w -- ------ d. whit morriss ------ - senior engineer, opencore - - http://www.openplans.org - - m: 415-710-8975 - "If you don't know where you are, you don't know anything at all" Dr. Edgar Spencer, Ph.D., 1995