From k.suess at gmx.net Sat Jul 1 14:07:54 2006 From: k.suess at gmx.net (=?ISO-8859-1?Q?Katja_S=FCss?=) Date: Sat, 01 Jul 2006 14:07:54 +0200 Subject: [z3-five] concept/organization of files Message-ID: <44A6659A.6010804@gmx.net> Hi all, according to my understanding of the view concept I thought to offer a view via its name (not template name). So the view should be called with .../annonces_view configure.zcml: Now if the number of files are increasing it would be nice to organize them in directories like browser |-portlets |- |-templates |-annonces_listing.pt As its not possible to use paths to templates(like for classes, etc) the template has to be in directory browser or a package 'templates' has to be declared in configure.zcml. Shouldn't it be possible to use paths to templates? Thanks for advice, Katja From lists at andreas-jung.com Sat Jul 1 15:18:41 2006 From: lists at andreas-jung.com (Andreas Jung) Date: Sat, 01 Jul 2006 15:18:41 +0200 Subject: [z3-five] concept/organization of files In-Reply-To: <44A6659A.6010804@gmx.net> References: <44A6659A.6010804@gmx.net> Message-ID: <0478F981A6512A664C2E80A3@[192.168.0.28]> --On 1. Juli 2006 14:07:54 +0200 Katja S?ss wrote: > > As its not possible to use paths to templates(like for classes, etc) the > template has to be in directory browser or a package 'templates' has to > be declared in configure.zcml. Shouldn't it be possible to use paths to > templates? Why is it impossible? You can of course use template="pt/my.pt" inside 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/20060701/c1ae251a/attachment.pgp From chris at simplistix.co.uk Tue Jul 11 18:46:09 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 11 Jul 2006 17:46:09 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n Message-ID: <44B3D5D1.2010603@simplistix.co.uk> Hi All, Okay, I'm now using Zope 3's i18n in Zope 2.9.3 but have hit a snag with Zope 2's ZPT... Zope 3's translation stuff returns unicode, Zope 2's ZPT seems to work in encoded strings so, when the list of text items is finally combined in the last stage of ZPT rendering, I'm getting unicode errors. I'm surprised no-one else has bumped into this unless I'm doing something stupid... Anyone? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Tue Jul 11 19:45:36 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 11 Jul 2006 18:45:36 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> Message-ID: <44B3E3C0.3040806@simplistix.co.uk> Lennart Regebro wrote: > On 7/11/06, Chris Withers wrote: >> I'm surprised no-one else has bumped into this unless I'm doing >> something stupid... > > I actually only have that problem if I do the translation within > python and then return unicode strings directly. It seems to me that > the ZPTs handle it correctly themselves in i18n statements. (Zope > 2.9). Where in the ZPT/publishing stack do the unicodes get encode to strings then? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Tue Jul 11 20:51:27 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 11 Jul 2006 19:51:27 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44B3E3C0.3040806@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> Message-ID: <44B3F32F.2030002@simplistix.co.uk> Chris Withers wrote: > Where in the ZPT/publishing stack do the unicodes get encode to strings > then? Answer: probably in the publisher somewhere. The root of this was "my bad", but I'm documenting it here for poor unfortunate souls in the future... Since Zope 3's i18n stuff returns unicode, you need to be ultra careful that the rest of your ZPT generates either 7-bit ascii or unicode. In my case, I was inserting the utf-8 encoded title of a document into a generated navigator... *sigh* Python's unicode error messages could be a little more helpful... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Tue Jul 11 21:14:22 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 11 Jul 2006 20:14:22 +0100 Subject: [z3-five] Zope 2.9 and Zope 3 i18n, more questions... In-Reply-To: <448026B2.1040502@hannosch.info> References: <447E9830.8010001@simplistix.co.uk> <447E9EF9.6050900@weitershausen.de> <447FED51.7090405@simplistix.co.uk> <447FF2AD.8020706@biologie.hu-berlin.de> <447FF5CC.9070502@simplistix.co.uk> <448026B2.1040502@hannosch.info> Message-ID: <44B3F88E.6000000@simplistix.co.uk> As an update... Hanno Schlichting wrote: > - configurable language negotiation based on a set of registered extractors > - extractors: browser language, cookie and URL segment All good... :-) (lemme know when it's ready ;-) ) > (maybe member > property but this is probably impossible in pure Zope3 right now) Well, this is something that each framework/project will probably do differently, but it'd be nice to be able to register just this rather than having to subclass and if-then-else the negotiation process... > - possibility to restrict allowed languages, so one can force sites into > English only mode or allow only a subset of available languages. isn't that just a special type of negotiation? > - Automatic generation of Gettext mo files from all registered po files > on server start or explicit refresh. I actually don't think this is a good idea anymore... the msgfmt tool provides lots of handy debugging info... > - if time permits implement a "tracker mode" (this is the PTS term, > Localizer has the same feature) which if turned on, collects and stores > all yet untranslated messages. I'm working on this right now... > This is the half-hearted implementation of the INegotiator, as it is > even mentioned in the interface description. Right now there are two > interfaces IUserPreferredLanguages and ILanguageAvailability of whom > only the first one is used by the Negotiator, whose responsibility it > should be to negotiate between the preferred and available languages. Indeed, I now have a translations class that implements ILanguageAvailability and ITranslationDomain as discussed in the other thread... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From maciej.wisniowski at coig.katowice.pl Wed Jul 12 09:55:26 2006 From: maciej.wisniowski at coig.katowice.pl (=?ISO-8859-2?Q?Maciej_Wi=B6niowski?=) Date: Wed, 12 Jul 2006 09:55:26 +0200 Subject: [z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue? Message-ID: <44B4AAEE.60707@coig.katowice.pl> Hi I have clean instance of Zope 2.8.6 and with just one product in Products - Five (1.2.5). I've written simple product with use of five directives but this product causes zope to report strange errors... why? Here is the description: Using ZMI I've created folder structure: mytest/ # Folder with one additional property: myattr:string = myvalue index_html # Python Script with one line: return context.body() /subfolder # Folder body # Page template with line:

When I'm visiting http://localhost:8080/mytest/subfolder I see: myvalue at output page and I think it is correct. Strange things happen when I add one more product. It's definition is below. After putting it to Products/ folder and restarting zope visiting http://localhost:8080/mytest/subfolder causes: Error Type: Unauthorized Error Value: You are not allowed to access 'myattr' in this context Maybe something is wrong in my product, or it's a bug in Five? With this kind of product I can see a lot of other errors too. Something like this: *Error Type: Unauthorized* *Error Value: No container provided. Access to 'xyz' of None, acquired through (Folder at /dev/sth/App/Main/Pages/home), denied.* Another thing - it is not possible to access: http://localhost:8080/++resource++tm_icon.gif but http://localhost:8080/mytest/++resource++tm_icon.gif works correctly. Is browser:addform supported correctly in this version of Five? I have few more questions about this directive, but I'll ask them later ;) My product that does nothing: Products/ testowy/ __init__.py # empty file main_module.py # main file configure.zcml # configuration tm_icon.gif # my icon # -------------main_module.py #!/usr/local/bin/python # -*- coding: utf-8 -*- from OFS.Folder import Folder from zope.interface import implements from zope.interface import Interface from zope.schema import Text, TextLine, Choice class ITestowyModule(Interface): """ TestowyModule """ title = TextLine( title=u"Title", required=False, description=u"The title of the TestowyModule.") class TestowyModule(Folder): """TestowyModule""" implements(ITestowyModule) def __init__(self, id, title): self.id = id self.title = title def TestowyModuleFactory(view, id, title): obj = TestowyModule(id, title) return obj.__of__(view.context) # ------------- configure.zcml -- Maciej Wisniowski From tim at sitefusion.co.uk Wed Jul 12 15:07:42 2006 From: tim at sitefusion.co.uk (Tim Hicks) Date: Wed, 12 Jul 2006 14:07:42 +0100 Subject: [z3-five] BrowserView and AttributeError on getPhysicalPath Message-ID: <44B4F41E.5020803@sitefusion.co.uk> Hi, I have a view.py module that looks like: # Five imports from Products.Five import BrowserView from Products.Five.browser.pagetemplatefile \ import ZopeTwoPageTemplateFile as PageTemplateFile class TopicView(BrowserView): """ """ topic_listing = PageTemplateFile('./topic_listing.pt') author_listing = PageTemplateFile('./author_listing.pt') topic_view = PageTemplateFile('./topic_view.pt') I have a ZCML snippet that looks like: When I visit a URL like .../[my_IWeblog_instance]/topics/ I get: Traceback (innermost last): Module ZPublisher.Publish, line 107, in publish Module Zope2.App.startup, line 227, in recordMetaData Module OFS.SimpleItem, line 380, in getPhysicalPath AttributeError: getPhysicalPath I'm trying to use the PageTemplateFiles with the Plone UI/macros. Does anyone have any idea why this isn't working? Thanks, Tim From tim at sitefusion.co.uk Wed Jul 12 21:05:18 2006 From: tim at sitefusion.co.uk (Tim Hicks) Date: Wed, 12 Jul 2006 20:05:18 +0100 Subject: [z3-five] BrowserView and AttributeError on getPhysicalPath In-Reply-To: <44B4F41E.5020803@sitefusion.co.uk> References: <44B4F41E.5020803@sitefusion.co.uk> Message-ID: <44B547EE.4000208@sitefusion.co.uk> Tim Hicks wrote: > Hi, > > I have a view.py module that looks like: > > # Five imports > from Products.Five import BrowserView > from Products.Five.browser.pagetemplatefile \ > import ZopeTwoPageTemplateFile as PageTemplateFile > > > class TopicView(BrowserView): > """ > """ > > topic_listing = PageTemplateFile('./topic_listing.pt') > author_listing = PageTemplateFile('./author_listing.pt') > topic_view = PageTemplateFile('./topic_view.pt') > > > I have a ZCML snippet that looks like: > > for=".interfaces.IWeblog" > class=".browser.view.TopicView" > attribute="topic_listing" > permission="zope2.View" > name="topics" /> > > > When I visit a URL like .../[my_IWeblog_instance]/topics/ I get: > > Traceback (innermost last): > Module ZPublisher.Publish, line 107, in publish > Module Zope2.App.startup, line 227, in recordMetaData > Module OFS.SimpleItem, line 380, in getPhysicalPath > AttributeError: getPhysicalPath > > > I'm trying to use the PageTemplateFiles with the Plone UI/macros. > > Does anyone have any idea why this isn't working? I should have said, I see this on Zope 2.8.4 with Five 1.2.5 and Zope 2.9.3 (so whatever Five that is). Also, I did *not* see this issue when I just directly declared the template in ZCML a la: I guess this means that SimpleViewClass somehow behaves differently to my BrowserView-based class, but I can't figure out where SimpleViewClass comes from, or what it looks like, so I'm having trouble following that line of enquiry. Tim Tim From robm at openplans.org Wed Jul 12 21:02:19 2006 From: robm at openplans.org (Rob Miller) Date: Wed, 12 Jul 2006 15:02:19 -0400 Subject: [z3-five] BrowserView and AttributeError on getPhysicalPath References: <44B4F41E.5020803@sitefusion.co.uk> Message-ID: On Wed, 12 Jul 2006 15:07:42 +0100, Tim Hicks wrote: > Hi, > > I have a view.py module that looks like: > > # Five imports > from Products.Five import BrowserView from > Products.Five.browser.pagetemplatefile \ > import ZopeTwoPageTemplateFile as PageTemplateFile > > > class TopicView(BrowserView): > """ > """ > > topic_listing = PageTemplateFile('./topic_listing.pt') > author_listing = PageTemplateFile('./author_listing.pt') topic_view > = PageTemplateFile('./topic_view.pt') > > > I have a ZCML snippet that looks like: > > for=".interfaces.IWeblog" > class=".browser.view.TopicView" > attribute="topic_listing" > permission="zope2.View" > name="topics" /> i don't know what, exactly, is causing your error, but to accomplish the same result i'd usually just use the "template" attribute on the browser:page directive rather than using attribute. then you can remove the attributes from the view class. this may not fix your problem, but it's worth trying, anyway. -r From tim at sitefusion.co.uk Wed Jul 12 23:41:48 2006 From: tim at sitefusion.co.uk (Tim Hicks) Date: Wed, 12 Jul 2006 22:41:48 +0100 Subject: [z3-five] BrowserView and AttributeError on getPhysicalPath In-Reply-To: References: <44B4F41E.5020803@sitefusion.co.uk> Message-ID: <44B56C9C.5090800@sitefusion.co.uk> Rob Miller wrote: > On Wed, 12 Jul 2006 15:07:42 +0100, Tim Hicks wrote: >> Hi, >> >> I have a view.py module that looks like: >> >> # Five imports >> from Products.Five import BrowserView from >> Products.Five.browser.pagetemplatefile \ >> import ZopeTwoPageTemplateFile as PageTemplateFile >> >> >> class TopicView(BrowserView): >> """ >> """ >> >> topic_listing = PageTemplateFile('./topic_listing.pt') >> author_listing = PageTemplateFile('./author_listing.pt') topic_view >> = PageTemplateFile('./topic_view.pt') >> >> >> I have a ZCML snippet that looks like: >> >> > for=".interfaces.IWeblog" >> class=".browser.view.TopicView" >> attribute="topic_listing" >> permission="zope2.View" >> name="topics" /> > > i don't know what, exactly, is causing your error, but to accomplish the > same result i'd usually just use the "template" attribute on the > browser:page directive rather than using attribute. then you can remove > the attributes from the view class. > > this may not fix your problem, but it's worth trying, anyway. Hi Rob, Yeah, using the "template" attribute does fix the problem. The reason I was trying to put things in a custom view class were twofold: 1. I was under the impression that this is somehow more correct; 2. I was actually trying to debug a separate issue with my traversal and view code, and wanted to have a bit more control over the view class to help with tracking that down. I feel a separate email to this list coming on discussing that issue, though. Once I hit this getPhysicalPath error, I figured that something wasn't right, and that I should try to track down the problem anyway. Has anyone else got view-ish templates working successfully with Plone? (I have had them working in the past, but am not sure what has changed.) Thanks, Tim From philipp at weitershausen.de Thu Jul 13 22:48:37 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 13 Jul 2006 22:48:37 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44B3F32F.2030002@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> Message-ID: <44B6B1A5.8050800@weitershausen.de> Chris Withers wrote: > Chris Withers wrote: >> Where in the ZPT/publishing stack do the unicodes get encode to strings >> then? > > Answer: probably in the publisher somewhere. Yes. In an ideal case (read: Zope 3), the application returns text as unicode and never has to bother with strings. The publisher will negotiate the best encoding with the browser and send 8 bits over the wire. > Since Zope 3's i18n stuff returns unicode, you need to be ultra careful > that the rest of your ZPT generates either 7-bit ascii or unicode. Right. Combining 8-bit strings and unicode can lead to terrible errors. I wish Python hadn't gone down that route of making strings and unicode objects compatible. Then it'd be crystal clear when you're doing something evil... > In my case, I was inserting the utf-8 encoded title of a document into a > generated navigator... I see. When in doubt, just make sure that anything ending up in a ZPT is unicode. Of course, ideally, those document titles would be stored not in UTF-8 but in unicode... Philipp From philipp at weitershausen.de Thu Jul 13 22:54:11 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 13 Jul 2006 22:54:11 +0200 Subject: [z3-five] Fwd: Re: class/content test Message-ID: <44B6B2F3.1080706@weitershausen.de> Balasz Ree sent me this patch with a failing test a while ago. I know what the fix is (removing a false descriminator of the ContentDirective handler), this is just to remind myself (and perhaps others) of this issue (so it won't get lost in the depths of my inbox). -------------- next part -------------- An embedded message was scrubbed... From: Balazs Ree Subject: Re: class/content test Date: Thu, 15 Jun 2006 20:31:15 +0200 Size: 6084 Url: http://codespeak.net/pipermail/z3-five/attachments/20060713/d422f33a/attachment.eml From philipp at weitershausen.de Thu Jul 13 22:57:54 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 13 Jul 2006 22:57:54 +0200 Subject: [z3-five] BrowserView and AttributeError on getPhysicalPath In-Reply-To: <44B547EE.4000208@sitefusion.co.uk> References: <44B4F41E.5020803@sitefusion.co.uk> <44B547EE.4000208@sitefusion.co.uk> Message-ID: <44B6B3D2.7060808@weitershausen.de> Tim Hicks wrote: > Tim Hicks wrote: >> Hi, >> >> I have a view.py module that looks like: >> >> # Five imports >> from Products.Five import BrowserView >> from Products.Five.browser.pagetemplatefile \ >> import ZopeTwoPageTemplateFile as PageTemplateFile >> >> >> class TopicView(BrowserView): >> """ >> """ >> >> topic_listing = PageTemplateFile('./topic_listing.pt') >> author_listing = PageTemplateFile('./author_listing.pt') >> topic_view = PageTemplateFile('./topic_view.pt') >> >> >> I have a ZCML snippet that looks like: >> >> > for=".interfaces.IWeblog" >> class=".browser.view.TopicView" >> attribute="topic_listing" >> permission="zope2.View" >> name="topics" /> >> >> >> When I visit a URL like .../[my_IWeblog_instance]/topics/ I get: >> >> Traceback (innermost last): >> Module ZPublisher.Publish, line 107, in publish >> Module Zope2.App.startup, line 227, in recordMetaData >> Module OFS.SimpleItem, line 380, in getPhysicalPath >> AttributeError: getPhysicalPath >> >> >> I'm trying to use the PageTemplateFiles with the Plone UI/macros. >> >> Does anyone have any idea why this isn't working? > > I should have said, I see this on Zope 2.8.4 with Five 1.2.5 and Zope > 2.9.3 (so whatever Five that is). > > Also, I did *not* see this issue when I just directly declared the > template in ZCML a la: > > for=".interfaces.IWeblog" > template="browser/topic_lists.pt" > permission="zope2.View" > name="topics" /> > > I guess this means that SimpleViewClass somehow behaves differently to > my BrowserView-based class, but I can't figure out where SimpleViewClass > comes from, or what it looks like, so I'm having trouble following that > line of enquiry. Oh boy :). You're down in the sewers of Zope 3, meaning its magic class creation. I should really pick up my pet project of removing this magic in Zope 3.4/2.12. Anyways, that magic "SimpleViewClass" thing indeed behaves differently when you have a template and when you don't. It shouldn't matter, though. Your case should work. By the way, if you're interested in tracking down this issue, take a look at Five/browser/metaconfigure.py. Put on your asbestus underwear, though. Perhaps you can create a patch for Five that demonstrates this issue with a failing test? Take a look at Five/browser/tests/pages.txt (and corresponding pages.zcml, pages.py, test_pages.py). There should be enough infrastructure (sample templates, etc.) there to produce a test case with small effort. Of course, you're also most welcome to fix the issue as well :). Philipp From philipp at weitershausen.de Thu Jul 13 23:06:22 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 13 Jul 2006 23:06:22 +0200 Subject: [z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue? In-Reply-To: <44B4AAEE.60707@coig.katowice.pl> References: <44B4AAEE.60707@coig.katowice.pl> Message-ID: <44B6B5CE.2060007@weitershausen.de> Maciej Wi?niowski wrote: > Hi > > I have clean instance of Zope 2.8.6 and with just one > product in Products - Five (1.2.5). I've written simple > product with use of five directives but this product causes > zope to report strange errors... why? Here is the description: > > Using ZMI I've created folder structure: > > mytest/ # Folder with one additional > property: myattr:string = myvalue > index_html # Python Script with one line: return > context.body() > /subfolder # Folder > body # Page template with line:

tal:content="context/myattr">

> > When I'm visiting http://localhost:8080/mytest/subfolder I see: > > myvalue > > at output page and I think it is correct. > Strange things happen when I add one more product. > It's definition is below. After putting it to Products/ > folder and restarting zope visiting > > http://localhost:8080/mytest/subfolder > > causes: > > Error Type: Unauthorized > Error Value: You are not allowed to access 'myattr' in this context > > Maybe something is wrong in my product, or it's a bug in Five? Perhaps. It's hard to judge from your code. If you can produce a failing unit test for Five, demonstrating a particular bug in Five, then we can start debugging. At this point it's hard to see what you're doing where etc. Of course, this mandates that you can find a very small set of circumstances where this occurs -- simply turning your product into a test will hardly make it more understandable ;). > Another thing - it is not possible to access: > > http://localhost:8080/++resource++tm_icon.gif > > but > > http://localhost:8080/mytest/++resource++tm_icon.gif > > works correctly. The root folder (OFS.Application.Application) is not traversable by default. Hence you won't be able to look up Zope3y things there. > Is browser:addform supported correctly in this version of Five? No idea what "correctly" means. It's supported, albeit in an awkward way regarding the content_factory. The tests demonstrate its behaviour well, though. Philipp From ree at ree.hu Fri Jul 14 11:01:45 2006 From: ree at ree.hu (Balazs Ree) Date: Fri, 14 Jul 2006 11:01:45 +0200 Subject: [z3-five] Fwd: Re: class/content test References: <44B6B2F3.1080706@weitershausen.de> Message-ID: On Thu, 13 Jul 2006 22:54:11 +0200, Philipp von Weitershausen wrote: > Balasz Ree sent me this patch with a failing test a while ago. I know what > the fix is (removing a false descriminator of the ContentDirective > handler), this is just to remind myself (and perhaps others) of this issue > (so it won't get lost in the depths of my inbox). Well, I did not see the attachment on your post, so just in case I post the patch (for not to be the only one who knows what the issue is). Briefly: currently when you add more interfaces to the same class with some consequtive (formerly ) directives, it results in a conflict. (Same thing does work with .) p.s. I did not get to understand how to fix it. Index: tests/classes.py =================================================================== --- tests/classes.py (revision 0) +++ tests/classes.py (revision 0) @@ -0,0 +1,32 @@ +############################################################################## +# +# Copyright (c) 2004, 2005 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""interfaces test fixtures + +$Id: $ +""" +from zope.interface import implements, Interface + +class One(object): + 'A class' + +class Two(object): + 'Another class' + +class IOne(Interface): + """This is a Zope 3 interface. + """ + +class ITwo(Interface): + """This is another Zope 3 interface. + """ Index: tests/test_directives.py =================================================================== --- tests/test_directives.py (revision 68659) +++ tests/test_directives.py (working copy) @@ -59,6 +59,14 @@ >>> dest.method() 'Overridden' + Check the result of the directives + + >>> from Products.Five.tests.classes import One, Two, IOne, ITwo + >>> IOne.implementedBy(One) + True + >>> ITwo.implementedBy(One) + True + Clean up adapter registry and others: >>> from zope.testing.cleanup import cleanUp Index: tests/directives.zcml =================================================================== --- tests/directives.zcml (revision 68659) +++ tests/directives.zcml (working copy) @@ -24,4 +24,15 @@ factory=".adapters.OriginalAdapter" /> + + + + + + + + + + -- Balazs Ree From rocky at serverzen.com Fri Jul 14 13:51:42 2006 From: rocky at serverzen.com (Rocky Burt) Date: Fri, 14 Jul 2006 09:21:42 -0230 Subject: [z3-five] BrowserView and AttributeError on getPhysicalPath In-Reply-To: <44B6B3D2.7060808@weitershausen.de> References: <44B4F41E.5020803@sitefusion.co.uk> <44B547EE.4000208@sitefusion.co.uk> <44B6B3D2.7060808@weitershausen.de> Message-ID: <1152877896.7871.4.camel@localhost> On Thu, 2006-13-07 at 22:57 +0200, Philipp von Weitershausen wrote: > Oh boy :). You're down in the sewers of Zope 3, meaning its magic class > creation. I should really pick up my pet project of removing this magic > in Zope 3.4/2.12. I *hope* you mean Zope 3.4/2.11 :) - 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060714/c2b0ddbe/attachment.pgp From maciej.wisniowski at coig.katowice.pl Sun Jul 16 23:24:26 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Sun, 16 Jul 2006 23:24:26 +0200 Subject: [z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue? In-Reply-To: <44B6B5CE.2060007@weitershausen.de> References: <44B4AAEE.60707@coig.katowice.pl> <44B6B5CE.2060007@weitershausen.de> Message-ID: <44BAAE8A.7070106@coig.katowice.pl> >Perhaps. It's hard to judge from your code. If you can produce a failing >unit test for Five, demonstrating a particular bug in Five, then we can >start debugging. > > I'm trying to write such test but... so far it still executes correctly... I'll keep trying. I have no experiences with writing tests so it's something new for me... :) > >The root folder (OFS.Application.Application) is not traversable by >default. Hence you won't be able to look up Zope3y things there. > > > But isn't OFS.Application.Application a place where five:registerClass looks for a icon defined for a product? I know... test... ;) -- Maciej Wisniowski From maciej.wisniowski at coig.katowice.pl Sun Jul 16 23:37:53 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Sun, 16 Jul 2006 23:37:53 +0200 Subject: [z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue? In-Reply-To: <44BAAE8A.7070106@coig.katowice.pl> References: <44B4AAEE.60707@coig.katowice.pl> <44B6B5CE.2060007@weitershausen.de> <44BAAE8A.7070106@coig.katowice.pl> Message-ID: <44BAB1B1.5080003@coig.katowice.pl> >The root folder (OFS.Application.Application) is not traversable by > default. Hence you won't be able to look up Zope3y things there. Or.. you mean I simply have to declare OFS.Application.Application traversable...? -- Maciej Wisniowski From maciej.wisniowski at coig.katowice.pl Sun Jul 16 23:55:28 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Sun, 16 Jul 2006 23:55:28 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44B6B1A5.8050800@weitershausen.de> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> Message-ID: <44BAB5D0.70703@coig.katowice.pl> >I see. When in doubt, just make sure that anything ending up in a ZPT is >unicode. Of course, ideally, those document titles would be stored not >in UTF-8 but in unicode... > > Does this mean that I should use unicode everywhere, even on data returned from database? I'm having some issues with unicode-decode errors and five too, but I'm not using i18n machinery. I have a view with a page template (containing some national characters) and a view class with function that returns utf-8 encoded string. Inserting string from the function into ZPT causes unicode-decode error but... just on one machine. Zope on two other computers doesn't report any errors. Changing my function to return unicode fixes the problem and view works correctly everywhere, but it is confucing that code works on one machine and fails on the other. Zope configuration is same: z-publisher-encoding utf-8 and locale pl_PL.UTF-8. Operating system is set to utf-8 everywhere. Any hints what should I check? Possibly it's somethin with OS, but I don't know what... -- Maciej Wisniowski From maciej.wisniowski at coig.katowice.pl Tue Jul 18 10:17:22 2006 From: maciej.wisniowski at coig.katowice.pl (=?UTF-8?B?TWFjaWVqIFdpxZtuaW93c2tp?=) Date: Tue, 18 Jul 2006 10:17:22 +0200 Subject: [z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue? In-Reply-To: <44B6B5CE.2060007@weitershausen.de> References: <44B4AAEE.60707@coig.katowice.pl> <44B6B5CE.2060007@weitershausen.de> Message-ID: <44BC9912.9080409@coig.katowice.pl> >Perhaps. It's hard to judge from your code. If you can produce a failing >unit test for Five, demonstrating a particular bug in Five, then we can >start debugging. > > I didn't manage to write failing test (even thought I tried few different variants). Even with just two products in instance: Five and ViewsTutorial, and folders structure in ZMI I've described before I have errors.. but tests are passing. The good news is that upgrading to Zope 2.8.8 solved this problem :) Maybe it was something in my Zope2.8.6 core files but I tried this on two different machines with the same effect... >The root folder (OFS.Application.Application) is not traversable by >default. Hence you won't be able to look up Zope3y things there. > > did the thing Thanks for your help! -- Maciej Wisniowski From plone at kevinkal.com Tue Jul 18 20:33:58 2006 From: plone at kevinkal.com (kevin7kal) Date: Tue, 18 Jul 2006 14:33:58 -0400 Subject: [z3-five] objects, security,etc Message-ID: <44BD2996.3080507@kevinkal.com> I am attempting to bring a new object class into zope five and having some issues that hopefully someone can help with. Here is a simple example of my situation. I have class.py,zclass.py class.py class1(object): '''a simple class'''' attribute1='a string'' attribute2='another string' class2(object): def __init__(self,value1,value2): def method1(): print somemethod def method2(): returnobject = class1() return returnobject zclass.py import class zclass2(SimpleItem,class.class2): """"doctstring"""" implements(Izclass2) def __init__(self,,tmpID='',tmpTITLE='') return I have all of the interface things done and the all classes in class.py are five traversable. I can use class2.method1 with no problems, but class2.method2 returns a class1 object. The problem is when I try to access any methods or attributes on the class1 object that is returned, I have permission denied. How can I make it so the methods and attributes of this object are accessable? From plone at kevinkal.com Tue Jul 18 21:28:00 2006 From: plone at kevinkal.com (kevin7kal) Date: Tue, 18 Jul 2006 15:28:00 -0400 Subject: [z3-five] objects, security,etc In-Reply-To: <44BD2996.3080507@kevinkal.com> References: <44BD2996.3080507@kevinkal.com> Message-ID: <44BD3640.3020705@kevinkal.com> I should mention, this is zope 2.9.3 kevin7kal wrote: > I am attempting to bring a new object class into zope five and having > some issues that hopefully someone can help with. > Here is a simple example of my situation. > I have class.py,zclass.py > class.py > > class1(object): > '''a simple class'''' > attribute1='a string'' > attribute2='another string' > > class2(object): > def __init__(self,value1,value2): > > def method1(): > print somemethod > > def method2(): > returnobject = class1() > return returnobject > > zclass.py > import class > > > zclass2(SimpleItem,class.class2): > """"doctstring"""" > implements(Izclass2) > def __init__(self,,tmpID='',tmpTITLE='') > return > > I have all of the interface things done and the all classes in class.py > are five traversable. > I can use class2.method1 with no problems, but class2.method2 returns a > class1 object. The problem is when I try to access any methods or > attributes on the class1 object that is returned, I have permission > denied. How can I make it so the methods and attributes of this object > are accessable? > > _______________________________________________ > z3-five mailing list > z3-five at codespeak.net > http://codespeak.net/mailman/listinfo/z3-five > > From apm13 at columbia.edu Wed Jul 19 02:54:27 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Tue, 18 Jul 2006 17:54:27 -0700 Subject: [z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue? In-Reply-To: <44BC9912.9080409@coig.katowice.pl> References: <44B4AAEE.60707@coig.katowice.pl> <44B6B5CE.2060007@weitershausen.de> <44BC9912.9080409@coig.katowice.pl> Message-ID: <365118370607181754r6af2dc24rcdd47126eb1cd851@mail.gmail.com> On 7/18/06, Maciej Wi?niowski wrote: > > >Perhaps. It's hard to judge from your code. If you can produce a failing > >unit test for Five, demonstrating a particular bug in Five, then we can > >start debugging. > > > > > I didn't manage to write failing test (even thought I tried few > different variants). > Even with just two products in instance: Five and ViewsTutorial, and > folders > structure in ZMI I've described before I have errors.. but tests are > passing. > The good news is that upgrading to Zope 2.8.8 solved this problem :) > Maybe it was something in my Zope2.8.6 core files but I tried this on > two different machines with the same effect... > > >The root folder (OFS.Application.Application) is not traversable by > >default. Hence you won't be able to look up Zope3y things there. > > > > > did the thing > > Thanks for your help! Ah, this must have been due to the old bug where Five's traversal machinery was not catching NotFound errors (which were raised by the OFS.App but not other folders), only AttributeErrors. This was fixed in Five a while back, Zope 2.8.7 was the first release to include the fix IIRC. Alec From maciej.wisniowski at coig.katowice.pl Wed Jul 19 07:53:52 2006 From: maciej.wisniowski at coig.katowice.pl (=?ISO-8859-2?Q?Maciej_Wi=B6niowski?=) Date: Wed, 19 Jul 2006 07:53:52 +0200 Subject: [z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue? In-Reply-To: <365118370607181754r6af2dc24rcdd47126eb1cd851@mail.gmail.com> References: <44B4AAEE.60707@coig.katowice.pl> <44B6B5CE.2060007@weitershausen.de> <44BC9912.9080409@coig.katowice.pl> <365118370607181754r6af2dc24rcdd47126eb1cd851@mail.gmail.com> Message-ID: <44BDC8F0.2010504@coig.katowice.pl> > Ah, this must have been due to the old bug where Five's traversal > machinery was not catching NotFound errors (which were raised by the > OFS.App but not other folders), only AttributeErrors. This was fixed > in Five a while back, Zope 2.8.7 was the first release to include the > fix IIRC. I'm not sure whether your'e talking about my first problem with acquisition or about the second problem with OFS.Application.Application? :) I have Zope 2.8.6 but with Five 1.2.5 in Products/ folder so with the patch you're talking about already included. -- Maciej Wisniowski From philipp at weitershausen.de Wed Jul 19 09:20:47 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 19 Jul 2006 09:20:47 +0200 Subject: [z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue? In-Reply-To: <44BAB1B1.5080003@coig.katowice.pl> References: <44B4AAEE.60707@coig.katowice.pl> <44B6B5CE.2060007@weitershausen.de> <44BAAE8A.7070106@coig.katowice.pl> <44BAB1B1.5080003@coig.katowice.pl> Message-ID: <44BDDD4F.7010303@weitershausen.de> Maciej Wisniowski wrote: > >The root folder (OFS.Application.Application) is not traversable by > >> default. Hence you won't be able to look up Zope3y things there. > Or.. you mean I simply have to declare OFS.Application.Application > traversable...? Yes From plone at kevinkal.com Wed Jul 19 14:38:28 2006 From: plone at kevinkal.com (kevin7kal) Date: Wed, 19 Jul 2006 08:38:28 -0400 Subject: [z3-five] objects, security,etc In-Reply-To: <44BD3640.3020705@kevinkal.com> References: <44BD2996.3080507@kevinkal.com> <44BD3640.3020705@kevinkal.com> Message-ID: <44BE27C4.8030101@kevinkal.com> I'm still having issues with this. I have tried adding and continue to recieve unauthorized error. I can create a my 'zclass' and do something like test=context.zclass.method2 print test return printed but continue to recieve unauthorized errors when I try to access the attributes print test.attribute1 I have tried to have class1 inherit from Aquisition.Explicit as well and still cannot access this object. Any suggestions are appreciated. kevin7kal wrote: > I should mention, this is zope 2.9.3 > > > kevin7kal wrote: > >> I am attempting to bring a new object class into zope five and having >> some issues that hopefully someone can help with. >> Here is a simple example of my situation. >> I have class.py,zclass.py >> class.py >> >> class1(object): >> '''a simple class'''' >> attribute1='a string'' >> attribute2='another string' >> >> class2(object): >> def __init__(self,value1,value2): >> >> def method1(): >> print somemethod >> >> def method2(): >> returnobject = class1() >> return returnobject >> >> zclass.py >> import class >> >> zclass2(SimpleItem,class.class2): >> """"doctstring"""" >> implements(Izclass2) >> def __init__(self,,tmpID='',tmpTITLE='') >> return >> >> I have all of the interface things done and the all classes in class.py >> are five traversable. >> I can use class2.method1 with no problems, but class2.method2 returns a >> class1 object. The problem is when I try to access any methods or >> attributes on the class1 object that is returned, I have permission >> denied. How can I make it so the methods and attributes of this object >> are accessable? >> >> _______________________________________________ >> z3-five mailing list >> z3-five at codespeak.net >> http://codespeak.net/mailman/listinfo/z3-five >> >> >> > _______________________________________________ > z3-five mailing list > z3-five at codespeak.net > http://codespeak.net/mailman/listinfo/z3-five > > From maciej.wisniowski at coig.katowice.pl Wed Jul 19 14:53:07 2006 From: maciej.wisniowski at coig.katowice.pl (=?UTF-8?B?TWFjaWVqIFdpxZtuaW93c2tp?=) Date: Wed, 19 Jul 2006 14:53:07 +0200 Subject: [z3-five] objects, security,etc In-Reply-To: <44BE27C4.8030101@kevinkal.com> References: <44BD2996.3080507@kevinkal.com> <44BD3640.3020705@kevinkal.com> <44BE27C4.8030101@kevinkal.com> Message-ID: <44BE2B33.9010602@coig.katowice.pl> >test=context.zclass.method2 >print test >return printed > > > Maybe try test=context.zclass.method2() with parentheses. How does your configure.zcml looks like? -- Maciej Wisniowski From y.2006_ at wcm-solutions.de Wed Jul 19 14:57:59 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Wed, 19 Jul 2006 14:57:59 +0200 Subject: [z3-five] pythonproducts monkey patches Message-ID: <44BE2C57.5070409@wcm-solutions.de> Hi! I'm not sure which collector to use for Five issues so I decided to report this to the list: The monkey patching code used in Five 1.4 is not very robust. If setupPythonProducts is called twice _originalGetPath is set twice - the second time with the patched getPath. This leads to an infinite recursion because the patched getPath calls _originalGetPath. The unit tests actually depend on the fact that test_externalmethods is usually run before test_registerPackage. If you change their order (AFAICS they are run in alphabetical order) you can see the problem. I stumbled over this issue because I did run the Five tests together with tests that initialize Five. Cheers, Yuppie From apm13 at columbia.edu Wed Jul 19 17:25:36 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Wed, 19 Jul 2006 08:25:36 -0700 Subject: [z3-five] Strange problems with Five 1.2.5 and Zope 2.8.6, addform issue? In-Reply-To: <44BDC8F0.2010504@coig.katowice.pl> References: <44B4AAEE.60707@coig.katowice.pl> <44B6B5CE.2060007@weitershausen.de> <44BC9912.9080409@coig.katowice.pl> <365118370607181754r6af2dc24rcdd47126eb1cd851@mail.gmail.com> <44BDC8F0.2010504@coig.katowice.pl> Message-ID: <365118370607190825l5060e5d0v1409b8475feaf724@mail.gmail.com> On 7/18/06, Maciej Wi?niowski wrot> > > Ah, this must have been due to the old bug where Five's traversal > > machinery was not catching NotFound errors (which were raised by the > > OFS.App but not other folders), only AttributeErrors. This was fixed > > in Five a while back, Zope 2.8.7 was the first release to include the > > fix IIRC. > > I'm not sure whether your'e talking about my first problem > with acquisition or about the second problem with > OFS.Application.Application? :) > > I have Zope 2.8.6 but with Five 1.2.5 in Products/ folder > so with the patch you're talking about already included. Well, the first problem is one that I believe is fixed in Zope 2.8.7 itself (it is due to an issue with acquiring values from a __bobo_traverse__ method, which is what Five uses for traversal). The second issue is due both to lacking a traversable declaration for the Aplication root itself, though even if you had made the root traversable with Zope 2.86/Five 1.2.4 it probably still would have failed in the same way due to the NotFound bug. Alec From chris at simplistix.co.uk Wed Jul 19 17:40:21 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 19 Jul 2006 16:40:21 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44B6B1A5.8050800@weitershausen.de> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> Message-ID: <44BE5265.6030801@simplistix.co.uk> Philipp von Weitershausen wrote: > Yes. In an ideal case (read: Zope 3), the application returns text as > unicode and never has to bother with strings. The publisher will > negotiate the best encoding with the browser and send 8 bits over the wire. Indeed. >> In my case, I was inserting the utf-8 encoded title of a document into a >> generated navigator... > > I see. When in doubt, just make sure that anything ending up in a ZPT is > unicode. Of course, ideally, those document titles would be stored not > in UTF-8 but in unicode... Hurm, I see a world of pain for Zope 2 going forward :-/ There are a _lot_ of apps that store encoded strings in attributes in Zope 2 :-/ Now authors of those apps will either have to: - do a massive and fine-toothed-comb data migration turning all encoded strings into unicode - change all their templates to have horrific stuff like:
...rather than:
- suffer frequent but not necessarilly reproducible, content-dependent unicode errors All of these suck a lot. Can we really do nothing better? Could the zpublisher-default-encoding be leverages somewhere in the mix to say "if it's a string, decode it like this"? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Wed Jul 19 17:41:01 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 19 Jul 2006 16:41:01 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44BAB5D0.70703@coig.katowice.pl> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BAB5D0.70703@coig.katowice.pl> Message-ID: <44BE528D.5000103@simplistix.co.uk> Maciej Wisniowski wrote: >> I see. When in doubt, just make sure that anything ending up in a ZPT is >> unicode. Of course, ideally, those document titles would be stored not >> in UTF-8 but in unicode... >> >> > Does this mean that I should use unicode everywhere, even on data > returned from database? Yes. cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From plone at kevinkal.com Wed Jul 19 21:31:11 2006 From: plone at kevinkal.com (kevin7kal) Date: Wed, 19 Jul 2006 15:31:11 -0400 Subject: [z3-five] objects, security,etc In-Reply-To: <44BE27C4.8030101@kevinkal.com> References: <44BD2996.3080507@kevinkal.com> <44BD3640.3020705@kevinkal.com> <44BE27C4.8030101@kevinkal.com> Message-ID: <44BE887F.9010000@kevinkal.com> Ok, I have written a sample product that illustrates what I am trying to accomplish and I have a sample python script for ttw testing that shows where my issues are. Attached is the product and here is some sample script in the zmi, create 'my Zclass object' then in a Script('Python') try this code MZ = context.Zclass2 #print MZ.attribute1b.method1() print MZ.attribute1b print MZ.attribute1a return printed this is what is returned attribute 1a but if line 4 in uncommented, the security error is returned and I don't understand how to get around that. All help is appreciated and if the answer was simple, please excuse my ignorance :-) kevin7kal wrote: > I'm still having issues with this. I have tried adding > > > > and continue to recieve unauthorized error. I can create a my 'zclass' > and do something like > test=context.zclass.method2 > print test > return printed > > but continue to recieve unauthorized errors when I try to access the > attributes > print test.attribute1 > > I have tried to have class1 inherit from Aquisition.Explicit as well and > still cannot access this object. > > Any suggestions are appreciated. > > kevin7kal wrote: > >> I should mention, this is zope 2.9.3 >> >> >> kevin7kal wrote: >> >> >>> I am attempting to bring a new object class into zope five and having >>> some issues that hopefully someone can help with. >>> Here is a simple example of my situation. >>> I have class.py,zclass.py >>> class.py >>> >>> class1(object): >>> '''a simple class'''' >>> attribute1='a string'' >>> attribute2='another string' >>> >>> class2(object): >>> def __init__(self,value1,value2): >>> >>> def method1(): >>> print somemethod >>> >>> def method2(): >>> returnobject = class1() >>> return returnobject >>> >>> zclass.py >>> import class >>> >>> zclass2(SimpleItem,class.class2): >>> """"doctstring"""" >>> implements(Izclass2) >>> def __init__(self,,tmpID='',tmpTITLE='') >>> return >>> >>> I have all of the interface things done and the all classes in class.py >>> are five traversable. >>> I can use class2.method1 with no problems, but class2.method2 returns a >>> class1 object. The problem is when I try to access any methods or >>> attributes on the class1 object that is returned, I have permission >>> denied. How can I make it so the methods and attributes of this object >>> are accessable? >>> >>> _______________________________________________ >>> z3-five mailing list >>> z3-five at codespeak.net >>> http://codespeak.net/mailman/listinfo/z3-five >>> >>> >>> >>> >> _______________________________________________ >> z3-five mailing list >> z3-five at codespeak.net >> http://codespeak.net/mailman/listinfo/z3-five >> >> >> > _______________________________________________ > z3-five mailing list > z3-five at codespeak.net > http://codespeak.net/mailman/listinfo/z3-five > > -------------- next part -------------- A non-text attachment was scrubbed... Name: sampleProduct.tgz Type: application/x-compressed Size: 1200 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20060719/6b07fe13/attachment.bin From plone at kevinkal.com Wed Jul 19 21:44:38 2006 From: plone at kevinkal.com (kevin7kal) Date: Wed, 19 Jul 2006 15:44:38 -0400 Subject: [z3-five] objects, security,etc In-Reply-To: <44BE887F.9010000@kevinkal.com> References: <44BD2996.3080507@kevinkal.com> <44BD3640.3020705@kevinkal.com> <44BE27C4.8030101@kevinkal.com> <44BE887F.9010000@kevinkal.com> Message-ID: <44BE8BA6.8050102@kevinkal.com> Sorry, line two is what gives a security error. kevin7kal wrote: > Ok, I have written a sample product that illustrates what I am trying > to accomplish and I have a sample python script for ttw testing that > shows where my issues are. > Attached is the product and here is some sample script > > in the zmi, create 'my Zclass object' > then in a Script('Python') try this code > MZ = context.Zclass2 > #print MZ.attribute1b.method1() > print MZ.attribute1b > print MZ.attribute1a > return printed > > this is what is returned > > > attribute 1a > > but if line 4 in uncommented, the security error is returned and I > don't understand how to get around that. > > All help is appreciated and if the answer was simple, please excuse my > ignorance :-) > > > > > From maciej.wisniowski at coig.katowice.pl Wed Jul 19 23:52:30 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Wed, 19 Jul 2006 23:52:30 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44BE5265.6030801@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> Message-ID: <44BEA99E.3070309@coig.katowice.pl> >Now authors of those apps will either have to: > >- do a massive and fine-toothed-comb data migration turning all encoded >strings into unicode > >- change all their templates to have horrific stuff like: >
tal:content="python:obj.getProperty('something','').decode('utf-8')"/> > ...rather than: >
> >- suffer frequent but not necessarilly reproducible, content-dependent >unicode errors > > Exactly. Yesterday I was rewriting a form that was build via ZMI (ZPT and PythonScripts) to Five product. I ecouncered same problems as you. > - suffer frequent but not necessarilly reproducible, content-dependent > unicode errors In my case, same code works on one machine but fails with unicode-decode errors on the second one... You need to be very very careful when writing something and even test the code on few machines... :-/ Other thing. Adding a new object (that uses addform directive and has 'title' field in it's schema - unicode!) to a folder (via ZMI), may result in strange characters displayed instead of national characters in other objects' titles or, in the worst case, Unicode-decode error when you're clicking on that folder in ZMI (you have to use Undo then because it's not possible to see the folder contents). -- Maciej Wisniowski From philipp at weitershausen.de Thu Jul 20 01:07:12 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 20 Jul 2006 01:07:12 +0200 Subject: [z3-five] pythonproducts monkey patches In-Reply-To: <44BE2C57.5070409@wcm-solutions.de> References: <44BE2C57.5070409@wcm-solutions.de> Message-ID: <44BEBB20.7060701@weitershausen.de> yuppie wrote: > I'm not sure which collector to use for Five issues so I decided to > report this to the list: Yeah, thanks. > The monkey patching code used in Five 1.4 is not very robust. We accept patches :). Seriously, we do, though this is Rocky's code so I hope he'll have something to say about this. > If > setupPythonProducts is called twice _originalGetPath is set twice - the > second time with the patched getPath. This leads to an infinite > recursion because the patched getPath calls _originalGetPath. This seems easy enough to reproduce in a test... > The unit tests actually depend on the fact that test_externalmethods is > usually run before test_registerPackage. If you change their order > (AFAICS they are run in alphabetical order) you can see the problem. No idea in what order tests are run. I think it might also change with the endinanness of your platform, the size of your screen and the colour of your underpants. > I stumbled over this issue because I did run the Five tests together > with tests that initialize Five. Well, you're actually not supposed to do that. Five tests will clean up after them nicely. Stuff that does installProduct('Five') will not. These two collide. The monkey patches, when tested, should clean up after themselves. ALL code that operates on global registries or does monkey patching should clean up after itself. If pythonproducts doesn't do that, it's a bug. (Note that zope.testing has a very nice hook for providing cleanup functions. We use this in various places in Five.) Philipp From rocky at serverzen.com Thu Jul 20 01:25:11 2006 From: rocky at serverzen.com (Rocky Burt) Date: Wed, 19 Jul 2006 20:55:11 -0230 Subject: [z3-five] pythonproducts monkey patches In-Reply-To: <44BEBB20.7060701@weitershausen.de> References: <44BE2C57.5070409@wcm-solutions.de> <44BEBB20.7060701@weitershausen.de> Message-ID: <1153351505.13188.3.camel@localhost> On Thu, 2006-20-07 at 01:07 +0200, Philipp von Weitershausen wrote: > We accept patches :). Seriously, we do, though this is Rocky's code so I > hope he'll have something to say about this. +1 > > If > > setupPythonProducts is called twice _originalGetPath is set twice - the > > second time with the patched getPath. This leads to an infinite > > recursion because the patched getPath calls _originalGetPath. Right, good catch. > The monkey patches, when tested, should clean up after themselves. ALL > code that operates on global registries or does monkey patching should > clean up after itself. If pythonproducts doesn't do that, it's a bug. I believe it probably doesn't. - 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060719/f07ab6b2/attachment.pgp From rnd at onego.ru Thu Jul 20 10:45:09 2006 From: rnd at onego.ru (Roman Susi) Date: Thu, 20 Jul 2006 11:45:09 +0300 Subject: [z3-five] UTF-8, Zope 2.9.x and MSIE Message-ID: <44BF4295.8080106@onego.ru> Hi, I have a problem using Zope 2.9.x Products.Five.form ... EditView, AddView - scandinavian letters (e.g. ?, ?) are erroneously stored in the object as a byte representation of utf-8 instead of correct text. And this happens only when browsing with MSIE. Also, there is no such problem when handling forms without any fancy EditView, AddView (just in a method), form enctype doesn't matter. Here two POSTs by MSIE and Firefox: Accept-Encoding: gzip, deflate Accept-Language: ru Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, */* Cache-Control: no-cache Connection: Keep-Alive Content-Length: 1955 Content-Type: multipart/form-data; boundary=---------------------------7d6271194014e Cookie: tree-expansion="xyxx"; tree-expansion="xyxx"; __ginger_snap="xyxx" Host: xyxx:9080 POST /xyxx/edit.html HTTP/1.1 Referer: http://xyxx.org:9080/xyxx/edit.html User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) -----------------------------7d6271194014e Content-Disposition: form-data; name="field.description" dfdfgdfgdfgdfg sdfsdf ............ -----------------------------7d6271194014e Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7 Accept-Encoding: gzip,deflate Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Connection: keep-alive Content-Length: 1916 Content-Type: multipart/form-data; boundary=---------------------------41184676334 Cookie: tree-expansion="xyxx"; tree-expansion="xyxx"; __ginger_snap="xyxx" Host: xyxx:9080 Keep-Alive: 300 POST /xyxx/edit.html HTTP/1.1 Referer: http://xyxx/xyxx/edit.html User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 -----------------------------41184676334 Content-Disposition: form-data; name="field.description" dfdfgdfgdfgdfg sdfsdf ............ -----------------------------41184676334 (dots are for nonASCII, encoding is utf8) The only simingly relevant difference is Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7 field issued by Firefox... Publisher encoding is set to utf-8 in zope.conf. If unicode string u contains broken data, then this small function corrects the unicode string: def fixMSIE(us): return unicode(eval(repr(us)[1:]), 'utf8') Something somewhere in Zope makes wrong assumption about encoding of the data (or does double decoding or...?)... Any ideas how to prevent this madness from happening? google search has not produced any meaningful results. Thanks! Regards, Roman From y.2006_ at wcm-solutions.de Thu Jul 20 11:05:28 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Thu, 20 Jul 2006 11:05:28 +0200 Subject: [z3-five] pythonproducts monkey patches In-Reply-To: <44BEBB20.7060701@weitershausen.de> References: <44BE2C57.5070409@wcm-solutions.de> <44BEBB20.7060701@weitershausen.de> Message-ID: <44BF4758.5040301@wcm-solutions.de> Hi Philipp! Philipp von Weitershausen wrote: > yuppie wrote: >> The monkey patching code used in Five 1.4 is not very robust. > > We accept patches :). Seriously, we do, though this is Rocky's code so I > hope he'll have something to say about this. I know ;) But I usually don't fix bugs myself if they have a low priority for me or if someone else checked in the broken code recently. >> The unit tests actually depend on the fact that test_externalmethods is >> usually run before test_registerPackage. If you change their order >> (AFAICS they are run in alphabetical order) you can see the problem. > > No idea in what order tests are run. I think it might also change with > the endinanness of your platform, the size of your screen and the colour > of your underpants. All I wanted to say is this: - tests should never rely on the order in which they are called - apparently this bug was never noticed because in all environments in which these tests were run so far test_externalmethods was called before test_registerPackage - renaming 'test_registerPackage' to 'test_a' did work for me to enforce a different order >> I stumbled over this issue because I did run the Five tests together >> with tests that initialize Five. > > Well, you're actually not supposed to do that. Five tests will clean up > after them nicely. Stuff that does installProduct('Five') will not. > These two collide. Sometimes I run tests I didn't write myself ;) So far the only issue was that installProduct('Five') doesn't make sure the ZCML is loaded because it might have been cleaned up by other tests. If you are aware of that they don't collide. setupPythonProducts is initialized with initialize(), not with ZCML. > The monkey patches, when tested, should clean up after themselves. ALL > code that operates on global registries or does monkey patching should > clean up after itself. If pythonproducts doesn't do that, it's a bug. That's one part of the solution. AFAICS other parts of Five make also sure they don't apply monkey patches twice. Either using __five_method__ or using some other bookkeeping. That makes things more robust. Cheers, Yuppie From rnd at onego.ru Thu Jul 20 13:49:06 2006 From: rnd at onego.ru (Roman Susi) Date: Thu, 20 Jul 2006 14:49:06 +0300 Subject: [z3-five] SOLVED Re: UTF-8, Zope 2.9.x and MSIE In-Reply-To: <44BF4295.8080106@onego.ru> References: <44BF4295.8080106@onego.ru> Message-ID: <44BF6DB2.2090902@onego.ru> hI! It seems, this small piece of code solves the problem (of course, it does mean that webapp doesn use anything except for utf8, which is my case): from Products.Five.form import EditView as EV, AddView as AV class EditView(EV): charsets = ("utf-8",) def _setPageEncoding(self): self.request.RESPONSE.setHeader( 'Content-Type', 'text/html; charset=utf-8') class AddView(AV): charsets = ("utf-8",) def _setPageEncoding(self): self.request.RESPONSE.setHeader( 'Content-Type', 'text/html; charset=utf-8') Then every part of a project should import these mended view-classes and not those from Five. Thank you for hints which came in privite email! Regards, Roman Roman Susi wrote: > Hi, > > I have a problem using Zope 2.9.x > Products.Five.form ... EditView, AddView > > - scandinavian letters (e.g. ?, ?) are erroneously stored in the object > as a byte representation of utf-8 instead of correct text. And this > happens only when browsing with MSIE. Also, there is no such problem > when handling forms without any fancy EditView, AddView (just in a > method), form enctype doesn't matter. > > Thanks! > > Regards, > Roman From philipp at weitershausen.de Thu Jul 20 14:22:18 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 20 Jul 2006 14:22:18 +0200 Subject: [z3-five] pythonproducts monkey patches In-Reply-To: <44BF4758.5040301@wcm-solutions.de> References: <44BE2C57.5070409@wcm-solutions.de> <44BEBB20.7060701@weitershausen.de> <44BF4758.5040301@wcm-solutions.de> Message-ID: <44BF757A.20009@weitershausen.de> yuppie wrote: >>> I stumbled over this issue because I did run the Five tests together >>> with tests that initialize Five. >> >> Well, you're actually not supposed to do that. Five tests will clean up >> after them nicely. Stuff that does installProduct('Five') will not. >> These two collide. > > Sometimes I run tests I didn't write myself ;) ... like the whole friggin' Plone test suite which installProduct()s a brazillion products?!? > So far the only issue was that installProduct('Five') doesn't make sure > the ZCML is loaded because it might have been cleaned up by other tests. > If you are aware of that they don't collide. setupPythonProducts is > initialized with initialize(), not with ZCML. I consider installProduct() harmful in either way, because it happens at test module import level, not at test setup or execution time. So, for example, even if the test runner was only looking for test modules, importing them to check whether they contain tests that match a certain condition (e.g. regex), installProduct() would be executed. installProduct() is evil. >> The monkey patches, when tested, should clean up after themselves. ALL >> code that operates on global registries or does monkey patching should >> clean up after itself. If pythonproducts doesn't do that, it's a bug. > > That's one part of the solution. AFAICS other parts of Five make also > sure they don't apply monkey patches twice. Either using __five_method__ > or using some other bookkeeping. That makes things more robust. Yes, but it's not enough. Monkey patches must be undoable (and the code doing monkey patches must provides hooks for undoign them) for tests. Let's say you run a test that exercises the monkey patches and then later, within the same test run, a test is run that doesn't expect the monkey patches in place. It's likely that the second test might fail. Proper test isolation is hard, I realize that. But zope.testing infrastructure makes it bearable, I think. Philipp From rocky at serverzen.com Thu Jul 20 14:26:07 2006 From: rocky at serverzen.com (Rocky Burt) Date: Thu, 20 Jul 2006 09:56:07 -0230 Subject: [z3-five] pythonproducts monkey patches In-Reply-To: <44BE2C57.5070409@wcm-solutions.de> References: <44BE2C57.5070409@wcm-solutions.de> Message-ID: <1153398354.28391.4.camel@localhost> On Wed, 2006-19-07 at 14:57 +0200, yuppie wrote: > I'm not sure which collector to use for Five issues so I decided to > report this to the list: > > The monkey patching code used in Five 1.4 is not very robust. If > setupPythonProducts is called twice _originalGetPath is set twice - the > second time with the patched getPath. This leads to an infinite > recursion because the patched getPath calls _originalGetPath. > > The unit tests actually depend on the fact that test_externalmethods is > usually run before test_registerPackage. If you change their order > (AFAICS they are run in alphabetical order) you can see the problem. > > I stumbled over this issue because I did run the Five tests together > with tests that initialize Five. Thanks for pointing this out. I've just committed a fix for this that I believe addresses your concerns. r69226: "Made the pythonproducts monkey patching more robust by checking to ensure patches aren't reapplied and cleaning up after itself." Regards, 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060720/c14ada5b/attachment.pgp From maciej.wisniowski at coig.katowice.pl Thu Jul 20 14:37:02 2006 From: maciej.wisniowski at coig.katowice.pl (=?UTF-8?B?TWFjaWVqIFdpxZtuaW93c2tp?=) Date: Thu, 20 Jul 2006 14:37:02 +0200 Subject: [z3-five] SOLVED Re: UTF-8, Zope 2.9.x and MSIE In-Reply-To: <44BF6DB2.2090902@onego.ru> References: <44BF4295.8080106@onego.ru> <44BF6DB2.2090902@onego.ru> Message-ID: <44BF78EE.6050603@coig.katowice.pl> >Thank you for hints which came in privite email! > > > Is this possible to put these hints on the list? Have you read posts in 'unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n' topic? After reading this I think that changing encoding this way in editform and addform isn't correct. These values should be unicode not utf-8 encoded strings. -- Maciej Wisniowski From plone at kevinkal.com Thu Jul 20 14:53:46 2006 From: plone at kevinkal.com (kevin7kal) Date: Thu, 20 Jul 2006 08:53:46 -0400 Subject: [z3-five] objects, security,etc In-Reply-To: <44BE8BA6.8050102@kevinkal.com> References: <44BD2996.3080507@kevinkal.com> <44BD3640.3020705@kevinkal.com> <44BE27C4.8030101@kevinkal.com> <44BE887F.9010000@kevinkal.com> <44BE8BA6.8050102@kevinkal.com> Message-ID: <44BF7CDA.20500@kevinkal.com> Maybe opening a tgz is more of a hassle for some. So I will cut and paste my code and hopefully someone can point out my errror. I create a 'Zclass2' object through the zmi and try this 'Script(Python)' MZ = context.Zclass2 #print MZ.attribute1b.method1() print MZ.attribute1b print MZ.attribute1a return printed if I uncomment line 2, it fails with unauthorized to access attribute 'attribute1b' --------------configure.zcml---------------------- -------------------myClass.py----------------------------------- class class1(object): ''' a simple class with some attributes and methods''' attribute1 = 'attribute 1' attribute2 = 'attribute 2' def __init__(self): '''simple init for the class''' return def method1(self): '''simple method 1''' print 'method1' return def method2(self): ''' simple method 2''' print 'method2' return class class2(object): ''' a second simple class with some attributes and methods''' attribute1a = 'attribute 1a' atrribute2a = 'attribute 2a' def __init__(self): '''simple init for the class''' return def method1a(self): '''simple method 1a''' return(class1) def method2a(self): '''simple method 2a''' return(class1.method1()) attribute1b = property(fget=method1a) attribute2b = property(fget=method2a) ----------------------myZClass.py------------------------- from zope.interface import implements from zope.schema.fieldproperty import FieldProperty from OFS.SimpleItem import Item, SimpleItem from persistent import Persistent import myClass from interfaces import * class Zclass2(SimpleItem,myClass.class2): '''a simple zope class that inherits from my class''' implements(Izclass2) def __init__(self,tmpID='',tmpTITLE=''): '''non empty docstring''' return --------------------interfaces.py---------------------------- from zope.interface import Interface from zope.schema import Text,TextLine class Izclass1(Interface): '''marker interface''' class Izclass2(Interface): '''marker interface''' Please-point me to the err in my ways :-) Thanks! From y.2006_ at wcm-solutions.de Thu Jul 20 15:22:26 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Thu, 20 Jul 2006 15:22:26 +0200 Subject: [z3-five] pythonproducts monkey patches In-Reply-To: <1153398354.28391.4.camel@localhost> References: <44BE2C57.5070409@wcm-solutions.de> <1153398354.28391.4.camel@localhost> Message-ID: <44BF8392.7020801@wcm-solutions.de> Hi Rocky! Rocky Burt wrote: > Thanks for pointing this out. I've just committed a fix for this that I > believe addresses your concerns. > > r69226: > "Made the pythonproducts monkey patching more robust by checking to > ensure patches aren't reapplied and cleaning up after itself." Great! The fix looks good and works for me. Just one remark: The alphabetical order hack was just meant as an easy way to demonstrate that the tests did depend on a specific order. I don't think it is a good idea to use this for testing. Just duplicating the line >>> pythonproducts.setupPythonProducts(app) has the same effect and is a much more explicit way to test this. And the cleanup can be tested at the end of the test as e.g. done in test_registerclass.py. BTW: I'm afraid there is an other issue with pythonproducts. Today I saw the same traceback as reported here: http://article.gmane.org/gmane.comp.web.zope.plone.user/55325 The problem went away after restarting Zope and I can't tell you how to reproduce this but it smells like a pythonproducts bug. Cheers, Yuppie From chris at simplistix.co.uk Fri Jul 21 16:57:37 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Fri, 21 Jul 2006 15:57:37 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44BE5265.6030801@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> Message-ID: <44C0EB61.1020206@simplistix.co.uk> Chris Withers wrote: > All of these suck a lot. Can we really do nothing better? Well, I actually buckled and put a sitecustomize.py on the python path that chanded the default codec from ascii to utf-8. I feel comfortable enough doing that with this project because I _know_ we've taken a lot of care to make sure that everything that's stored is stored utf-8 encoded. If you're unlucky enough to have mixed encodings stored in strings, paticularly in zodb or relational database, then you're basically fucked ;-) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From plone at kevinkal.com Sat Jul 22 18:55:25 2006 From: plone at kevinkal.com (kevin7kal) Date: Sat, 22 Jul 2006 12:55:25 -0400 Subject: [z3-five] accessing object from a list constructed in __init__.py Message-ID: <44C2587D.4030008@kevinkal.com> I'm doing some work with Five and have an aquisition related issue. first, zope is zope 2.9.3 The trouble is with accessing the attributes of objects stored in the number property in class2. accessing class1.number via class2.method1a is no problem, the problem seems to stem from constructing a list of objects ala class2.__init__, if I try to append obj.__of__ in attribute1a I recieve an error that I can not pickle a wrapped class. Is there some other trick with acquisition to be able to access the attributes of an object which is stored in a list of object constructed in the __init__ function of a class? --myClass.py import Acquisition class class1(Acquisition.Explicit): ''' a simple class with some attributes and methods''' attribute1 = 'attribute 1' attribute2 = 'attribute 2' _number = '' def __init__(self,number2): '''simple init for the class''' self._number=number2*3 def method1(self): '''return a string methd1''' mthd1 = 'methd1' return mthd1 def method2(self): ''' return a string methd2''' mthd2 = 'method2' return mthd2 def _get_number(self): return self._number number = property(fget=_get_number) class class2(object): ''' a second simple class with some attributes and methods''' attribute1a = [] attribute2a = [] def __init__(self): '''create a list of class1 objects in attribute1a''' i=1 while i < 5: obj = class1(i) self.attribute1a.append(obj) i=i+1 def method1a(self): '''instantiate class1 as object and return object usable by zope''' obj = class1(5) return obj.__of__(self) def method2a(self): '''returns class1.method1()''' c1m1 = class1.method1() return c1m1 attribute1b = property(fget=method1a) attribute2b = property(fget=method2a) From maciej.wisniowski at coig.katowice.pl Sun Jul 23 13:01:47 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Sun, 23 Jul 2006 13:01:47 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C0EB61.1020206@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> Message-ID: <44C3571B.5070801@coig.katowice.pl> >Well, I actually buckled and put a sitecustomize.py on the python path >that chanded the default codec from ascii to utf-8. > > > Is this possible to see that code? I'm very interested in it :) And in general why is unicode object better than utf-8 encoded string? -- Maciej Wisniowski From rnd at onego.ru Mon Jul 24 07:37:31 2006 From: rnd at onego.ru (Roman Susi) Date: Mon, 24 Jul 2006 08:37:31 +0300 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44B6B1A5.8050800@weitershausen.de> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> Message-ID: <44C45C9B.1020108@onego.ru> Hi! Philipp von Weitershausen wrote: > Chris Withers wrote: > >>Chris Withers wrote: >> >>>Where in the ZPT/publishing stack do the unicodes get encode to strings >>>then? >> >>Answer: probably in the publisher somewhere. > > > Yes. In an ideal case (read: Zope 3), the application returns text as > unicode and never has to bother with strings. The publisher will > negotiate the best encoding with the browser and send 8 bits over the wire. We had the same problems too. And what makes things worse is that some legacy pieces of software (in our case it was ZopeTree) assume str, no Unicode. Even exportimport fails in our project due to the facts strings are stored in Unicode! (Zope 2.9) So, it is good advice "not to mix", but it is not always clear where things are coming from in reality. >>Since Zope 3's i18n stuff returns unicode, you need to be ultra careful >>that the rest of your ZPT generates either 7-bit ascii or unicode. > > > Right. Combining 8-bit strings and unicode can lead to terrible errors. > I wish Python hadn't gone down that route of making strings and unicode > objects compatible. Then it'd be crystal clear when you're doing > something evil... > > >>In my case, I was inserting the utf-8 encoded title of a document into a >>generated navigator... > > > I see. When in doubt, just make sure that anything ending up in a ZPT is > unicode. Of course, ideally, those document titles would be stored not > in UTF-8 but in unicode... We use this util function to minimize the textual bloat explicit unicode conversions bring: def u(s, encoding="utf-8"): """Convert from UTF8 to Unicode (if needed)""" try: return unicode(s, encoding) except TypeError: # Already Unicode? return unicode(s) > > Philipp Regards, Roman From rnd at onego.ru Mon Jul 24 07:48:11 2006 From: rnd at onego.ru (Roman Susi) Date: Mon, 24 Jul 2006 08:48:11 +0300 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C3571B.5070801@coig.katowice.pl> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> Message-ID: <44C45F1B.3030101@onego.ru> Maciej Wisniowski wrote: >>Well, I actually buckled and put a sitecustomize.py on the python path >>that chanded the default codec from ascii to utf-8. >> >> >> > > Is this possible to see that code? I'm very interested in it :) I know people sometimes do it, but it makes code unportable and could cause other subtle problems. > > And in general why is unicode object better than > utf-8 encoded string? Unicode object is more preferable because it is easier to process (that is, you you do not just store text but apply regular expressions, searches, calculate lengths, etc.). Of course, usual 1-byte encoding is even more simpler to use but it is not suitable on international scale. So, utf-8 encoded strings are convenient only as Unicode serialization: when sending Unicode over network, when storing in byte-oriented layers (like Unicode-unaware database or XML file). Unicode is more fun also. Regards, Roman From maciej.wisniowski at coig.katowice.pl Mon Jul 24 09:28:52 2006 From: maciej.wisniowski at coig.katowice.pl (=?UTF-8?B?TWFjaWVqIFdpxZtuaW93c2tp?=) Date: Mon, 24 Jul 2006 09:28:52 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C45F1B.3030101@onego.ru> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> Message-ID: <44C476B4.20209@coig.katowice.pl> >>Is this possible to see that code? I'm very interested in it :) >> >> > >I know people sometimes do it, but it makes code unportable and could >cause other subtle problems. > > I've already found some examples of sitecustomize.py that change defaultencoding. We're using windows and linux so it may be unportable, but I think it may be still helpful in some cases. Maybe it should be a option in zope.conf that will allow to change this behaviour. Firstly I though that 'zpublisher-default-encoding' or 'locale' will do the thing... but, as you know, it doesn't. >Unicode is more fun also. > > But is more difficult especially for begineers and especially in Zope2. It's a bit strange to write strings with u'. I've never seen this in other languages. So far it seems that we have to use functions like yours: def u(s, encoding="utf-8"): """Convert from UTF8 to Unicode (if needed)""" ... for data stored in attributes and for data retrieved from database and be careful to use u'...' strings instead of '...'. Any other clues for Five programmers? :) -- Maciej Wisniowski From rnd at onego.ru Mon Jul 24 10:03:54 2006 From: rnd at onego.ru (Roman Susi) Date: Mon, 24 Jul 2006 11:03:54 +0300 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C476B4.20209@coig.katowice.pl> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> <44C476B4.20209@coig.katowice.pl> Message-ID: <44C47EEA.6060705@onego.ru> Maciej Wi?niowski wrote: > >>> Is this possible to see that code? I'm very interested in it :) >>> >> >> >> I know people sometimes do it, but it makes code unportable and could >> cause other subtle problems. >> >> > I've already found some examples of sitecustomize.py that > change defaultencoding. > We're using windows and linux so it may be unportable, but > I think it may be still helpful in some cases. I do not mean portability in a sense of different OSes -- i mean portability between sites. For example, for the same reasons it is not good to use time.strftime() to format your string for email, for example, because its locale-aware and email messages use strict format for that (there is rfc822.formatdate and maybe some newer function to do it) > > Maybe it should be a option in zope.conf that will allow to > change this behaviour. Firstly I though that > 'zpublisher-default-encoding' or 'locale' will do the thing... > but, as you know, it doesn't. > >> Unicode is more fun also. >> >> > But is more difficult especially for begineers and > especially in Zope2. It's a bit strange to write > strings with u'. I've never seen this in other languages. > Python 3000 will change this. Everything will be Unicode. Also, if you have a lot of text content, why not separate it from the code? > So far it seems that we have to use functions like > yours: > > def u(s, encoding="utf-8"): > """Convert from UTF8 to Unicode (if needed)""" > ... > > > for data stored in attributes and for data > retrieved from database and be careful to use > u'...' strings instead of '...'. Some databases (or at least their Zope adapters) are aware of unicode - for example PostgreSQL. > > > Any other clues for Five programmers? :) > try to do things and gather experience. There are no coherent top-down guides (I mean guides which describe things from concepts to concretics), only module-oriented documentation (source code, tests, books) and problem-oriented cookbook-style docs for zope3... And I think it is very important to study those new concepts of Zope3 which are coming at theoretical level and they dive into practical work. Five is in flux in square, between Zope3 and Zope2... Regards, Roman Susi From chris at simplistix.co.uk Mon Jul 24 14:15:27 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 24 Jul 2006 13:15:27 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C45F1B.3030101@onego.ru> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> Message-ID: <44C4B9DF.4000507@simplistix.co.uk> Roman Susi wrote: > Maciej Wisniowski wrote: >>> Well, I actually buckled and put a sitecustomize.py on the python path >>> that chanded the default codec from ascii to utf-8. >>> >> Is this possible to see that code? I'm very interested in it :) > > I know people sometimes do it, but it makes code unportable How so? None of the code that could usefully be ported from this project relies on this fact (it all just runs off unicode), but the project specific code does, and I think that's a safe assumption to make, given what I've already stated... > and could > cause other subtle problems. Such as? (or is this just goat/chicken worship?) >> And in general why is unicode object better than >> utf-8 encoded string? > > Unicode object is more preferable because it is easier to process (that > is, you you do not just store text but apply regular expressions, > searches, calculate lengths, etc.). Of course, usual 1-byte encoding is > even more simpler to use but it is not suitable on international scale. > > So, utf-8 encoded strings are convenient only as Unicode serialization: > when sending Unicode over network, when storing in byte-oriented layers > (like Unicode-unaware database or XML file). ...or more simply put, you don't get Unicode errors if everything is Unicode, and that's a pretty big win for me ;-) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Mon Jul 24 14:13:28 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 24 Jul 2006 13:13:28 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C3571B.5070801@coig.katowice.pl> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> Message-ID: <44C4B968.5080403@simplistix.co.uk> Maciej Wisniowski wrote: > >> Well, I actually buckled and put a sitecustomize.py on the python path >> that chanded the default codec from ascii to utf-8. >> > Is this possible to see that code? I'm very interested in it :) From memory, create a sitecustomize.py on your PYTHONPATH: import sys sys.setdefaultencoding('utf-8') cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From rnd at onego.ru Mon Jul 24 20:48:08 2006 From: rnd at onego.ru (Roman Susi) Date: Mon, 24 Jul 2006 21:48:08 +0300 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C4B9DF.4000507@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> <44C4B9DF.4000507@simplistix.co.uk> Message-ID: <44C515E8.7010407@onego.ru> Chris Withers wrote: > Roman Susi wrote: > >> Maciej Wisniowski wrote: >> >>>> Well, I actually buckled and put a sitecustomize.py on the python >>>> path that chanded the default codec from ascii to utf-8. >>>> >>> Is this possible to see that code? I'm very interested in it :) >> >> >> I know people sometimes do it, but it makes code unportable > > > How so? None of the code that could usefully be ported from this > project relies on this fact (it all just runs off unicode), but the > project specific code does, and I think that's a safe assumption to > make, given what I've already stated... http://blog.ianbicking.org/illusive-setdefaultencoding.html?version=1%3fversion%3d1 But perhaps my fears arent wellgrounded - I never used sitecustomize as it somehow feels bad... >> and could >> cause other subtle problems. > > > Such as? (or is this just goat/chicken worship?) People more experienced than me warned against that (it was on the Russian Python-Zope list http://itconnection.ru/pipermail/zopyrus/2006-April/083160.html). Using sitecustomize means it should be remembered somehow on each installation and upgrade. If this is no problem - then it is no problem. Roman From optilude at gmx.net Tue Jul 25 02:43:56 2006 From: optilude at gmx.net (Martin Aspeli) Date: Tue, 25 Jul 2006 01:43:56 +0100 Subject: [z3-five] Integration tests with Five and ZCML Message-ID: Hi, We've known for some time that it's Bad? that PloneTestCase does: ZopeTestCase.installProduct('Five') I discovered that if I mix any tests using PloneTestCase (and this statement, at module level) with any pure-Zope3 test that uses zope.app.testing.placelesssetup.setUp (with or without a corresponding .tearDown) I get strange and confusing errors even though the tests in question run fine if the PloneTestCase tests are separated from the Zope3-style ones. Well, you told me so. But my question is, how *should* PloneTestCase be behaving. Bear in mind that in this case we're really talking about integration tests. We *want* PTC to load "all ZCML for all of Products/" (or at least all other products registered with installProduct()). We'd rather not require test authors to think about a dependency tree of ZCML files and load them all. For unit tests that's good, but for integration tests (which are sadly still the most prevalent and convenient in the Zope2 world - too many objects to mock, too much reliance on things like acquisition) we want to make sure the environment behaves as closely to Zope2-on-startup as is reasonable. We've been bemoaning this problem for a long time. I'd like to get it out of the world once and for all. ;-) Martin From maciej.wisniowski at coig.katowice.pl Tue Jul 25 10:19:26 2006 From: maciej.wisniowski at coig.katowice.pl (=?ISO-8859-2?Q?Maciej_Wi=B6niowski?=) Date: Tue, 25 Jul 2006 10:19:26 +0200 Subject: [z3-five] Question about skins usage Message-ID: <44C5D40E.1000405@coig.katowice.pl> Hi I've written product that defines my skin (named Skintest) but as far as I found I can use this in two ways only: 1. by writing ++skin++Skintest/ in url 2. by defining my skin as defaultSkin with overrides.zcml I based on Web Component Development with Zope3 from Philipp von Weitershausen, althouht I'm using Zope 2.9.4 and Five 1.4 now. Say, I would like to have few skins used in few different products. Is there a way to define which view uses which skin? Or how should I define URLs in my application to take care about skins? So far I'm using something like '%s/@@some_view.html' % (context.absolute_url()) do I have to write: '%s/++skin++Skintest/@@some_view.html' % (context.absolute_url()) or implement something as a skin chooser like: '%s/%s/@@some_view.html' % (context.getCurrentSkin(), context.absolute_url()) What is the preffered way of doing such things? -- Maciej Wisniowski From philipp at weitershausen.de Tue Jul 25 10:29:01 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 25 Jul 2006 10:29:01 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C476B4.20209@coig.katowice.pl> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> <44C476B4.20209@coig.katowice.pl> Message-ID: <44C5D64D.7000808@weitershausen.de> Maciej Wi?niowski wrote: >>> Is this possible to see that code? I'm very interested in it :) >>> >>> >> I know people sometimes do it, but it makes code unportable and could >> cause other subtle problems. >> >> > I've already found some examples of sitecustomize.py that > change defaultencoding. > We're using windows and linux so it may be unportable, but > I think it may be still helpful in some cases. > > Maybe it should be a option in zope.conf that will allow to > change this behaviour. Firstly I though that > 'zpublisher-default-encoding' or 'locale' will do the thing... > but, as you know, it doesn't. > >> Unicode is more fun also. >> >> > But is more difficult especially for begineers It's pretty easy, I think. Most people just don't explain it well enough. Unicode is an *abstraction*, like an image you see on your screen. An image on your screen cannot be saved simply like that. You have to save it in some sort of format, which means, in some way that arranges bytes. There are several of such formats, e.g. PNG, JPG, etc. Some of them are "lossy" because they cannot transfer the whole image information. Same with unicode. A unicode object is a nice object-oriented abstraction. It can hold any unicode "character". But, you cannot simply save unicode to the filesystem or send it over the wire. You have to do this in bytes, and again, a format (=encoding) tells you how to convert unicode into such a format. Some of the are lossy (because they don't support the whole Unicode range) and some of them aren't (e.g. UTF-*). To make a long story short: - In Python, we want to work with the abstraction. Working with 8bit-strings is like working with the byte representation of an image to do image manipulation. That sucks - When going to the filesystem or the HTTP client, we have to use some encoding. We really only need to worry about the filesystem; talking to the HTTP client is the ZPublisher's task. And, since the ZPublisher is a Python component, we want to talk unicode to it. The ZODB is also a Python component. Hence, we store unicode. SQL database adapters are also Python components. They really SHOULD give us unicode, not some 8bit encoded jibberish. Now, I realize there's legacy data in the ZODB where 8bit strings are stored. When you know this, you can explicitly deal with this. But don't introduce legacy when writing new stuff... > and especially in Zope2. It's a bit strange to write strings with u'. > I've never seen this in other languages. And I've never seen meaningful indention in other languages. What's your point? You want to reject unicode because you don't like its syntax??? > So far it seems that we have to use functions like > yours: > > def u(s, encoding="utf-8"): > """Convert from UTF8 to Unicode (if needed)""" > ... Huh? Simply do some_unicode_string.encode('utf-8'). But, again, unless you're actually writing stuff to the filesystem, I doubt you should ever have to manually encode or decode stuff, even in Zope 2 (provided you use certain helpers from Five). > for data stored in attributes and for data retrieved from database > and be careful to use u'...' strings instead of '...'. Anything that contains human text should be unicode. That's a very simple rule. Philipp From maciej.wisniowski at coig.katowice.pl Tue Jul 25 11:26:02 2006 From: maciej.wisniowski at coig.katowice.pl (=?UTF-8?B?TWFjaWVqIFdpxZtuaW93c2tp?=) Date: Tue, 25 Jul 2006 11:26:02 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C5D64D.7000808@weitershausen.de> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> <44C476B4.20209@coig.katowice.pl> <44C5D64D.7000808@weitershausen.de> Message-ID: <44C5E3AA.9090509@coig.katowice.pl> >It's pretty easy, I think. Most people just don't explain it well enough. > > You're right, when starting with python it is rather difficult to find out what and why this unicode is. I understand it, but thanks for this nice explatation, it will be helpful :) >>and especially in Zope2. It's a bit strange to write strings with u'. >>I've never seen this in other languages. >> >> > >And I've never seen meaningful indention in other languages. What's your >point? You want to reject unicode because you don't like its syntax??? > > No! I'm not rejecting unicode. I simply don't like writing u'...' :) I think it may be error prone and difficult for newcomers to track down unicode decode errors that appear because of forgetting about this. But I understand why u'syntax is used now. As Roman Susi said in other topic, in Python3000 everything will be unicode, so I understand we'll have not to use u'syntax, do we? When I'm reading posts from me, Chris Withers, Roman Susi and others I can say that unicode in Five isn't so easy in practice, especially without good documentation, and clear rules such: "Anything that contains human text should be unicode" :) >Huh? Simply do some_unicode_string.encode('utf-8'). But, again, unless >you're actually writing stuff to the filesystem, I doubt you should ever >have to manually encode or decode stuff, even in Zope 2 (provided you >use certain helpers from Five). > > Yes you should'n have to encode or decode but, as you said before, only if you don't have to deal with legacy stuff, things that are setup via ZMI (like attributes of folders etc.), database adapters that don't use unicode etc. I have all such things right now so the method from Roman Susi that try: excepts: is nice for me. I definitely agree we should move everything to unicode, but it's not so easy. If somebody has to write something new and knows the rules then he'll possibly have no such problems... until he forgets about u'...' somewhere ;) -- Maciej Wisniowski From chris at simplistix.co.uk Tue Jul 25 11:46:27 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 25 Jul 2006 10:46:27 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C476B4.20209@coig.katowice.pl> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> <44C476B4.20209@coig.katowice.pl> Message-ID: <44C5E873.2010804@simplistix.co.uk> Maciej Wi?niowski wrote: > I've already found some examples of sitecustomize.py that > change defaultencoding. > We're using windows and linux so it may be unportable, but > I think it may be still helpful in some cases. I don't think the OS has anything to do with this... > Maybe it should be a option in zope.conf that will allow to > change this behaviour. nah, it needs to happen way before then, hence sitecustomize.py >> Unicode is more fun also. >> > But is more difficult especially for begineers and > especially in Zope2. It's a bit strange to write > strings with u'. I've never seen this in other languages. Yes, Python 3000 will fix this... > for data stored in attributes and for data > retrieved from database and be careful to use > u'...' strings instead of '...'. Well, that's only true for constants. Otherwise, you just need to make sure you turn strings into unicodes as soon as possible... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Tue Jul 25 11:50:58 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 25 Jul 2006 10:50:58 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C515E8.7010407@onego.ru> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> <44C4B9DF.4000507@simplistix.co.uk> <44C515E8.7010407@onego.ru> Message-ID: <44C5E982.3000103@simplistix.co.uk> Roman Susi wrote: > > http://blog.ianbicking.org/illusive-setdefaultencoding.html?version=1%3fversion%3d1 I don't really see the relevance of that thread... > But perhaps my fears arent wellgrounded - I never used sitecustomize as > it somehow feels bad... Yeah, well, I for one am glad it's there :-) > People more experienced than me warned against that (it was on the > Russian Python-Zope list > http://itconnection.ru/pipermail/zopyrus/2006-April/083160.html). Using > sitecustomize means it should be remembered somehow on each installation > and upgrade. If this is no problem - then it is no problem. Well if you have a decent buildout process, which you _should_ (and I do - all my instance's are completely svn'ed) then this isn't a problem... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From faassen at infrae.com Tue Jul 25 13:13:52 2006 From: faassen at infrae.com (Martijn Faassen) Date: Tue, 25 Jul 2006 13:13:52 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44BE5265.6030801@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> Message-ID: <44C5FCF0.90407@infrae.com> Chris Withers wrote: > Philipp von Weitershausen wrote: >> Yes. In an ideal case (read: Zope 3), the application returns text as >> unicode and never has to bother with strings. The publisher will >> negotiate the best encoding with the browser and send 8 bits over the wire. > > Indeed. > >>> In my case, I was inserting the utf-8 encoded title of a document into a >>> generated navigator... >> I see. When in doubt, just make sure that anything ending up in a ZPT is >> unicode. Of course, ideally, those document titles would be stored not >> in UTF-8 but in unicode... > > Hurm, I see a world of pain for Zope 2 going forward :-/ It is a world of pain indeed - Infrae has been dealing with this world of pain for years now as Silva *is* one of the few appications in Zope 2 that behaves well for unicode. PlacelessTranslationService, which has extremely nasty workarounds to allow users to combine encoded strings with unicode strings was hurting us, as it introduced subtle bugs in previously well-behaved code. What the right way should be for existing Zope 2 applications I do not know. For *new* Zope 2 applications, my strong recommendation would be to store human-readable text as unicode, and if your text is stored externally (file, rdb), to decode it into unicode as soon as possible when it enters your application. Regards, Martijn From faassen at infrae.com Tue Jul 25 13:14:52 2006 From: faassen at infrae.com (Martijn Faassen) Date: Tue, 25 Jul 2006 13:14:52 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C0EB61.1020206@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> Message-ID: <44C5FD2C.7070505@infrae.com> Chris Withers wrote: > Chris Withers wrote: >> All of these suck a lot. Can we really do nothing better? > > Well, I actually buckled and put a sitecustomize.py on the python path > that chanded the default codec from ascii to utf-8. > > I feel comfortable enough doing that with this project because I _know_ > we've taken a lot of care to make sure that everything that's stored is > stored utf-8 encoded. > > If you're unlucky enough to have mixed encodings stored in strings, > paticularly in zodb or relational database, then you're basically fucked ;-) This is an extremely dangerous option indeed, as it may break libraries which depend on Python's behavior being differently. Regards, Martijn From faassen at infrae.com Tue Jul 25 13:21:49 2006 From: faassen at infrae.com (Martijn Faassen) Date: Tue, 25 Jul 2006 13:21:49 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C5E982.3000103@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> <44C4B9DF.4000507@simplistix.co.uk> <44C515E8.7010407@onego.ru> <44C5E982.3000103@simplistix.co.uk> Message-ID: <44C5FECD.4020802@infrae.com> Chris Withers wrote: > Roman Susi wrote: >> http://blog.ianbicking.org/illusive-setdefaultencoding.html?version=1%3fversion%3d1 > > I don't really see the relevance of that thread... This is what I wrote about it a while back: http://faassen.n--tree.net/blog/view/weblog/2005/08/02/0 Regards, Martijn From philipp at weitershausen.de Tue Jul 25 13:47:16 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 25 Jul 2006 13:47:16 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <44C5D40E.1000405@coig.katowice.pl> References: <44C5D40E.1000405@coig.katowice.pl> Message-ID: <44C604C4.8080809@weitershausen.de> Maciej Wi?niowski wrote: > Hi > > I've written product that defines my skin (named Skintest) but as far as > I found I > can use this in two ways only: > > 1. by writing ++skin++Skintest/ in url > 2. by defining my skin as defaultSkin with overrides.zcml 3. wherever you want you can attach a skin to the request, e.g. during traversal somewhere. > I based on Web Component Development with Zope3 from > Philipp von Weitershausen, althouht I'm using Zope 2.9.4 and > Five 1.4 now. > > Say, I would like to have few skins used in few different products. Why? The one-layer-per-product rule from the CMF is pretty stupid. > Is there a way to define which view uses which skin? Not really. > Or how should I define URLs in my application to take care > about skins? Why do you need this at all? What's your use case? Let's start there and see if several skins are actually necessary. Philipp From philipp at weitershausen.de Tue Jul 25 14:02:24 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 25 Jul 2006 14:02:24 +0200 Subject: [z3-five] Integration tests with Five and ZCML In-Reply-To: References: Message-ID: <44C60850.90001@weitershausen.de> Martin Aspeli wrote: > Hi, > > We've known for some time that it's Bad? that PloneTestCase does: > > ZopeTestCase.installProduct('Five') > > I discovered that if I mix any tests using PloneTestCase (and this > statement, at module level) with any pure-Zope3 test that uses > zope.app.testing.placelesssetup.setUp (with or without a corresponding > .tearDown) I get strange and confusing errors even though the tests in > question run fine if the PloneTestCase tests are separated from the > Zope3-style ones. Right. This is EXACTLY why the installProduct('Five') thing is bad. It makes tests that care about (and expect) proper test clean up break, because installProduct('Five') itself knows nothing about proper cleanup and cannot do it. > Well, you told me so. But my question is, how *should* PloneTestCase be > behaving. Well, IIRC, PTC is pretty much used for any test case in Plone-related tests? I mean, how can you even *call* these things unit tests... Anyways, if PTC is meant to handle integration tests only, and you want PTC to load up Five's ZCML and all the ZCML of all the products there are, then here's what you do: def afterSetUp(self): from Products.Five import zcml zcml.load_site() # this loads site.zcml def beforeTearDown(self): zope.testing.cleanup.cleanUp() Now, of course, this will sloooooow. It will load and tear down all ZCML stuff for *each* test. A better way would be to use a layer: class FiveIntegrationTestLayer(object): @classmethod def setUp(cls): from Products.Five import zcml zcml.load_site() # this loads site.zcml @classmethod def tearDown(cls): zope.testing.cleanup.cleanUp() And PTC would simply do: class PloneTestCase(ZopeTestCase): layer = FiveIntegrationTestLayer ... Note that neither PTC nor any test that derives from PTC should register new components or even tear down anything (e.g. using zope.testing.cleanup). THe idea with layers is that the layer does the setup and tear down of test fixtures ONCE. Perhaps we should add FiveIntegrationTestLayer to Five. Even better, we should convert ZopeTestCase to use layers as well, FiveIntegrationTestLayer just being one of those layers. I've been meaning to do that for some time now (http://www.z3lab.org/sections/blogs/philipp-weitershausen/2006_03_10_death-to-zopetestcase), just haven't gotten around to do it... too busy dealing with Zope bugs at EuroPython... Philipp From maciej.wisniowski at coig.katowice.pl Tue Jul 25 14:05:13 2006 From: maciej.wisniowski at coig.katowice.pl (=?UTF-8?B?TWFjaWVqIFdpxZtuaW93c2tp?=) Date: Tue, 25 Jul 2006 14:05:13 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <44C604C4.8080809@weitershausen.de> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> Message-ID: <44C608F9.7040607@coig.katowice.pl> >>1. by writing ++skin++Skintest/ in url >>2. by defining my skin as defaultSkin with overrides.zcml >> >> > >3. wherever you want you can attach a skin to the request, e.g. during >traversal somewhere. > > What do you mean by attaching skin to the request? Isn't it point 1? > >Why do you need this at all? What's your use case? Let's start there and >see if several skins are actually necessary. > > I'm just wondering about. My use case is that I'll have several applications and much more products in one Zope instance. It seems to be possible to need something different in skin somewhere, but as I said it is now just wondering about. That's why I'm asking about how it should be done :) So you mean that using overrides.zcml is preffered way? -- Maciej Wisniowski From philipp at weitershausen.de Tue Jul 25 14:12:28 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 25 Jul 2006 14:12:28 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <44C608F9.7040607@coig.katowice.pl> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <44C608F9.7040607@coig.katowice.pl> Message-ID: <44C60AAC.7040102@weitershausen.de> Maciej Wi?niowski wrote: > >>> 1. by writing ++skin++Skintest/ in url >>> 2. by defining my skin as defaultSkin with overrides.zcml >>> >> >> 3. wherever you want you can attach a skin to the request, e.g. during >> traversal somewhere. >> >> > What do you mean by attaching skin to the request? Isn't it point 1? Point 1 is just one spelling of changing a skin during traversal; it could also be "invisible", e.g: www.car-shop.com # default skin used www.car-shop.com/usedcars # different skin because different shop In this case, a traversal hook in "usedcars" changed the skin. >> Why do you need this at all? What's your use case? Let's start there and >> see if several skins are actually necessary. >> >> > I'm just wondering about. My use case is that I'll have several > applications and much more products in one Zope instance. Let's drop the term "products", I never get the right kind of connotation when it's used. So, you have several applications in a Zope instance. That's indeed a use case for having different skins. Each application probably wants its own skin. The question is, how will these different applications be reachable? Will they get different domains? Then you can use rewrite rules: www.car-shop.com -> http://localhost:8080/++skin++CarShop/carshop www.usedcars.com -> http://localhost:8080/++skin++UsedCars/usedcars If they are part of the same domain, use traversal hooks as described above (www.car-shop.com vs. www.car-shop.com/usecars). Philipp From maciej.wisniowski at coig.katowice.pl Tue Jul 25 15:08:41 2006 From: maciej.wisniowski at coig.katowice.pl (=?UTF-8?B?TWFjaWVqIFdpxZtuaW93c2tp?=) Date: Tue, 25 Jul 2006 15:08:41 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <44C60AAC.7040102@weitershausen.de> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <44C608F9.7040607@coig.katowice.pl> <44C60AAC.7040102@weitershausen.de> Message-ID: <44C617D9.2080402@coig.katowice.pl> >Will they get different domains? Then you can use rewrite rules: > > www.car-shop.com -> http://localhost:8080/++skin++CarShop/carshop > www.usedcars.com -> http://localhost:8080/++skin++UsedCars/usedcars > >If they are part of the same domain, use traversal hooks as described >above (www.car-shop.com vs. www.car-shop.com/usecars). > > We have many environments for our applications (developement, testing, learning etc.) so I think traversal hooks are better choice. I've never played with them but seems that I have to add something like: def __before_publishing_traverse__(self, object, REQUEST): """ Pre-traversal hook. """ # check if there is no skin already and # add/modify a skin to REQUEST['TraversalRequestNameStack'] or REQUEST.path I'll look for more examples of this. Thanks. -- Maciej Wisniowski From philipp at weitershausen.de Tue Jul 25 15:23:09 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 25 Jul 2006 15:23:09 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <44C617D9.2080402@coig.katowice.pl> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <44C608F9.7040607@coig.katowice.pl> <44C60AAC.7040102@weitershausen.de> <44C617D9.2080402@coig.katowice.pl> Message-ID: <44C61B3D.1090709@weitershausen.de> Maciej Wi?niowski wrote: > >> Will they get different domains? Then you can use rewrite rules: >> >> www.car-shop.com -> http://localhost:8080/++skin++CarShop/carshop >> www.usedcars.com -> http://localhost:8080/++skin++UsedCars/usedcars >> >> If they are part of the same domain, use traversal hooks as described >> above (www.car-shop.com vs. www.car-shop.com/usecars). >> >> > We have many environments for our applications (developement, testing, > learning etc.) > so I think traversal hooks are better choice. I've never played with > them but > seems that I have to add something like: > > def __before_publishing_traverse__(self, object, REQUEST): > """ Pre-traversal hook. > """ > # check if there is no skin already and > # add/modify a skin to REQUEST['TraversalRequestNameStack'] or > REQUEST.path Shrug! Don't mess with the traversal name stack. Simply use IMySkin.providedBy(request) for checking whether the request has your skin and zope.app.publisher.browser.applySkin(request, IMySkin) for applying the skin to the request. Remember: Skins are just interfaces (that provide ISkin). Philipp From maciej.wisniowski at coig.katowice.pl Tue Jul 25 15:28:58 2006 From: maciej.wisniowski at coig.katowice.pl (=?UTF-8?B?TWFjaWVqIFdpxZtuaW93c2tp?=) Date: Tue, 25 Jul 2006 15:28:58 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <44C61B3D.1090709@weitershausen.de> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <44C608F9.7040607@coig.katowice.pl> <44C60AAC.7040102@weitershausen.de> <44C617D9.2080402@coig.katowice.pl> <44C61B3D.1090709@weitershausen.de> Message-ID: <44C61C9A.2040900@coig.katowice.pl> Philipp von Weitershausen napisa?(a): >Shrug! Don't mess with the traversal name stack. Simply use >IMySkin.providedBy(request) for checking whether the request has your >skin and zope.app.publisher.browser.applySkin(request, IMySkin) for >applying the skin to the request. > >Remember: Skins are just interfaces (that provide ISkin). > > > Yes, looks much better :) Thanks again for your help and explanations! -- Maciej Wisniowski From pw_lists at slinkp.com Tue Jul 25 16:21:52 2006 From: pw_lists at slinkp.com (Paul Winkler) Date: Tue, 25 Jul 2006 10:21:52 -0400 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C5D64D.7000808@weitershausen.de> References: <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> <44C476B4.20209@coig.katowice.pl> <44C5D64D.7000808@weitershausen.de> Message-ID: <20060725142152.GA9857@slinkp.com> On Tue, Jul 25, 2006 at 10:29:01AM +0200, Philipp von Weitershausen wrote: > Maciej Wi??niowski wrote: > > But is more difficult especially for begineers > > It's pretty easy, I think. Most people just don't explain it well enough. Recommended reading: http://www.joelonsoftware.com/articles/Unicode.html -- Paul Winkler http://www.slinkp.com From regebro at gmail.com Tue Jul 25 16:22:00 2006 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 25 Jul 2006 16:22:00 +0200 Subject: [z3-five] Deprecating the old local site support Message-ID: <319e029f0607250722v43fd6401u40e756052586d438@mail.gmail.com> In Five 1.3 we introduced local site support. In Five 1.5 it gets obsolete with the new site suport in zope.component. So, I'm gonna deprecate it. Because the number of people using this is low, and the new support is better, and the old one is messier than the new one, and you can't use both at the same time, I think it would be good if we have a short deprecation period for this, and deprecate it already for 2.11. Silence = agreement. :) Opinions, questions? -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From pw_lists at slinkp.com Tue Jul 25 16:25:34 2006 From: pw_lists at slinkp.com (Paul Winkler) Date: Tue, 25 Jul 2006 10:25:34 -0400 Subject: [z3-five] Question about skins usage In-Reply-To: <44C604C4.8080809@weitershausen.de> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> Message-ID: <20060725142534.GB9857@slinkp.com> On Tue, Jul 25, 2006 at 01:47:16PM +0200, Philipp von Weitershausen wrote: > Why? The one-layer-per-product rule from the CMF is pretty stupid. Which rule is that? My old CMF code frequently used multiple layers. -- Paul Winkler http://www.slinkp.com From tseaver at palladion.com Tue Jul 25 18:00:49 2006 From: tseaver at palladion.com (Tres Seaver) Date: Tue, 25 Jul 2006 12:00:49 -0400 Subject: [z3-five] Question about skins usage In-Reply-To: <20060725142534.GB9857@slinkp.com> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <20060725142534.GB9857@slinkp.com> Message-ID: <44C64031.9030908@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Paul Winkler wrote: > On Tue, Jul 25, 2006 at 01:47:16PM +0200, Philipp von Weitershausen wrote: >> Why? The one-layer-per-product rule from the CMF is pretty stupid. > > Which rule is that? My old CMF code frequently used multiple layers. Hmmm, maybe Philipp doesn't really believe in layers? The original point of layering was to allow reuse-with-override; later, the layers became a way to organize "related" skin objects on disk. If you aren't trying for those goals, then layers are definitely overhead you don't need. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFExkAx+gerLs4ltQ4RAjYbAJ9JaCEa6jxPKJqbNk+6Tc2M2MrSNwCeIpOh lEj/mihuT0Uz0uTkchmppBE= =BOr+ -----END PGP SIGNATURE----- From y.2006_ at wcm-solutions.de Tue Jul 25 23:02:10 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Tue, 25 Jul 2006 23:02:10 +0200 Subject: [z3-five] SVN: Products.Five/branches/1.4/ Backported the traversal order changes from zope 2.10 In-Reply-To: <20060713234801.BEB892032C8@mail.zope.org> References: <20060713234801.BEB892032C8@mail.zope.org> Message-ID: <44C686D2.2050600@wcm-solutions.de> Hi! Alec Mitchell wrote: > Log message for revision 69121: > Backported the traversal order changes from zope 2.10 There's a bug in that change. HEAD requests (and I guess also other FTP/WebDAV requests) trigger this error: ERROR Zope.SiteErrorLog http://www.example.org/mySite/virtual_hosting// Traceback (innermost last): Module ZPublisher.Publish, line 106, in publish Module ZPublisher.BaseRequest, line 325, in traverse Module webdav.NullResource, line 66, in __bobo_traverse__ NotFound: The requested resource was not found. The VirtualHostMonster adds 'virtual_hosting//' to the URL (don't ask me why). 'virtual_hosting' has to be acquired, but now a NullResource is created instead. Cheers, Yuppie From philipp at weitershausen.de Wed Jul 26 01:25:05 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 26 Jul 2006 01:25:05 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <44C64031.9030908@palladion.com> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <20060725142534.GB9857@slinkp.com> <44C64031.9030908@palladion.com> Message-ID: <44C6A851.9080006@weitershausen.de> Tres Seaver wrote: > Paul Winkler wrote: >>> On Tue, Jul 25, 2006 at 01:47:16PM +0200, Philipp von Weitershausen wrote: >>>> Why? The one-layer-per-product rule from the CMF is pretty stupid. >>> Which rule is that? My old CMF code frequently used multiple layers. > > Hmmm, maybe Philipp doesn't really believe in layers? The original > point of layering was to allow reuse-with-override; later, the layers > became a way to organize "related" skin objects on disk. If you aren't > trying for those goals, then layers are definitely overhead you don't need. I do like layers. What I don't like is a common pattern in CMF, or rather, in extension products for the CMF which makes up for the missing "default" layer in the CMF. Say you have a blog product for the CMF, and blog objects have an edit form (blog_edit_form) and a display page (blog_view). These views are typically on the filesystem. Now the product wants to get them into the CMF. The only way to sanely do that is to put them into a directory, register that directory as a layer in the skins tool AND (this is the wicked part) modify all skins to include this layer. I don't think layers were made for that. There's no reason for these standard (!) object views to be on a special layer that you can switch on or off, that your skin can decide to include or not. They should just be "there". That's why we have the "default" layer in Zope 3. I find layers useful, but only in one context: producing skins. The "default" layer has no skinning, that's what specialized layers are for. I'd say 99% of the things I would put on a layer other than the default one is skin-related (skin macro, resources like logo images, CSS, JavaScript, etc.). Philipp From philipp at weitershausen.de Wed Jul 26 01:28:51 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 26 Jul 2006 01:28:51 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <20060725142534.GB9857@slinkp.com> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <20060725142534.GB9857@slinkp.com> Message-ID: <44C6A933.4000604@weitershausen.de> Paul Winkler wrote: > On Tue, Jul 25, 2006 at 01:47:16PM +0200, Philipp von Weitershausen wrote: >> Why? The one-layer-per-product rule from the CMF is pretty stupid. > > Which rule is that? My old CMF code frequently used multiple layers. Right. But there's no way for a CMF product to have zero layers and still get views registered. Most products don't really contribute anything to a skin. THey just want to get their object views (edit, view, etc.) registered. Philipp From philipp at weitershausen.de Wed Jul 26 01:31:10 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 26 Jul 2006 01:31:10 +0200 Subject: [z3-five] Deprecating the old local site support In-Reply-To: <319e029f0607250722v43fd6401u40e756052586d438@mail.gmail.com> References: <319e029f0607250722v43fd6401u40e756052586d438@mail.gmail.com> Message-ID: <44C6A9BE.8020804@weitershausen.de> Lennart Regebro wrote: > In Five 1.3 we introduced local site support. In Five 1.5 it gets > obsolete with the new site suport in zope.component. So, I'm gonna > deprecate it. > > Because the number of people using this is low, and the new support is > better, and the old one is messier than the new one, and you can't use > both at the same time, I think it would be good if we have a short > deprecation period for this, and deprecate it already for 2.11. We can deprecate it *in* Zope 2.11, sure. That means we can remove it in Zope 2.13. From tseaver at palladion.com Wed Jul 26 03:08:01 2006 From: tseaver at palladion.com (Tres Seaver) Date: Tue, 25 Jul 2006 21:08:01 -0400 Subject: [z3-five] Question about skins usage In-Reply-To: <44C6A851.9080006@weitershausen.de> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <20060725142534.GB9857@slinkp.com> <44C64031.9030908@palladion.com> <44C6A851.9080006@weitershausen.de> Message-ID: <44C6C071.20700@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Philipp von Weitershausen wrote: > Tres Seaver wrote: >> Paul Winkler wrote: >>>> On Tue, Jul 25, 2006 at 01:47:16PM +0200, Philipp von Weitershausen wrote: >>>>> Why? The one-layer-per-product rule from the CMF is pretty stupid. >>>> Which rule is that? My old CMF code frequently used multiple layers. >> Hmmm, maybe Philipp doesn't really believe in layers? The original >> point of layering was to allow reuse-with-override; later, the layers >> became a way to organize "related" skin objects on disk. If you aren't >> trying for those goals, then layers are definitely overhead you don't need. > > I do like layers. What I don't like is a common pattern in CMF, or > rather, in extension products for the CMF which makes up for the missing > "default" layer in the CMF. Its absence is *by design* (see below). > Say you have a blog product for the CMF, and blog objects have an edit > form (blog_edit_form) and a display page (blog_view). These views are > typically on the filesystem. Now the product wants to get them into the > CMF. The only way to sanely do that is to put them into a directory, > register that directory as a layer in the skins tool AND (this is the > wicked part) modify all skins to include this layer. > > I don't think layers were made for that. There's no reason for these > standard (!) object views to be on a special layer that you can switch > on or off, that your skin can decide to include or not. They should just > be "there". That's why we have the "default" layer in Zope 3. That makes the product harder to reuse, as the "policy" choices are embedded in the product. (We don't yet have a reasonable way to include only part of an add-on's configuration in ZCML, or to disable part of it after inclusion). Layering in the CMF means that including skin methods ("views") from an add-on product is an explicit choice, with per-layer granularity. In Zope3, the granularity tneds to be "per add-on", as many add-ons have *all* their configuratoin lumped together. > I find layers useful, but only in one context: producing skins. The > "default" layer has no skinning, that's what specialized layers are for. > I'd say 99% of the things I would put on a layer other than the default > one is skin-related (skin macro, resources like logo images, CSS, > JavaScript, etc.). I don't think we have enough experience in the Zope3 world with combining large numbers of third-party products, and tweaking the resulting highly-complex configuration, to claim that Zope3's model is intrinsically superior to the one evolved for Zope2 + CMF. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFExsBw+gerLs4ltQ4RAg7PAJ0emp8WaUZDSs7WBJO37OU0urecfQCgn/ul 2iyRxoQ2kFMA1rLR0kAK1Is= =jSHA -----END PGP SIGNATURE----- From philipp at weitershausen.de Wed Jul 26 08:17:53 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 26 Jul 2006 08:17:53 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <44C6C071.20700@palladion.com> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <20060725142534.GB9857@slinkp.com> <44C64031.9030908@palladion.com> <44C6A851.9080006@weitershausen.de> <44C6C071.20700@palladion.com> Message-ID: <44C70911.7030704@weitershausen.de> Tres Seaver wrote: > Philipp von Weitershausen wrote: >>> Tres Seaver wrote: >>>> Paul Winkler wrote: >>>>>> On Tue, Jul 25, 2006 at 01:47:16PM +0200, Philipp von Weitershausen wrote: >>>>>>> Why? The one-layer-per-product rule from the CMF is pretty stupid. >>>>>> Which rule is that? My old CMF code frequently used multiple layers. >>>> Hmmm, maybe Philipp doesn't really believe in layers? The original >>>> point of layering was to allow reuse-with-override; later, the layers >>>> became a way to organize "related" skin objects on disk. If you aren't >>>> trying for those goals, then layers are definitely overhead you don't need. >>> I do like layers. What I don't like is a common pattern in CMF, or >>> rather, in extension products for the CMF which makes up for the missing >>> "default" layer in the CMF. > > Its absence is *by design* (see below). That's almost hard to believe (though surely not impossible). I would have guessed it's as much "by design" as the big flat namespace in the CMF is by design (which yields to view names like document_edit_form and document_view instead of just edit and view). Surely *somebody* made the CMF use implicit acquisition throughout... that doesn't mean it was a "design choice". >>> Say you have a blog product for the CMF, and blog objects have an edit >>> form (blog_edit_form) and a display page (blog_view). These views are >>> typically on the filesystem. Now the product wants to get them into the >>> CMF. The only way to sanely do that is to put them into a directory, >>> register that directory as a layer in the skins tool AND (this is the >>> wicked part) modify all skins to include this layer. >>> >>> I don't think layers were made for that. There's no reason for these >>> standard (!) object views to be on a special layer that you can switch >>> on or off, that your skin can decide to include or not. They should just >>> be "there". That's why we have the "default" layer in Zope 3. > > That makes the product harder to reuse, as the "policy" choices are > embedded in the product. (We don't yet have a reasonable way to include > only part of an add-on's configuration in ZCML, or to disable part of it > after inclusion). Layering in the CMF means that including skin methods > ("views") from an add-on product is an explicit choice, with per-layer > granularity. In Zope3, the granularity tneds to be "per add-on", as > many add-ons have *all* their configuratoin lumped together. I don't question the flexibility and usefulness of all this. I'm still a fan of layers, but I also think they're just overdone in the CMF. You have to jump through lots of hoops just to get a simple view Page Template publishable from the filesystem. And of all, the common install 'trick' that monkeys with all existing skins so that they include the new layer turns my stomach... Of course, having a "default" layer doesn't mean you can't do all this in Zope 3. If you deliberately put all the stuff from different packages in different layers, you basically end up with what the CMF has got. It just doesn't seem common practice... (and I think I know why: nobody needs it). As for granularity of configuration, I think we could be making use of zcml:condition a lot more to make thigns more flexible. Surely, 3rd party packages that want to be very flexible (e.g. the CMF) can encourage its usage. >>> I find layers useful, but only in one context: producing skins. The >>> "default" layer has no skinning, that's what specialized layers are for. >>> I'd say 99% of the things I would put on a layer other than the default >>> one is skin-related (skin macro, resources like logo images, CSS, >>> JavaScript, etc.). > > I don't think we have enough experience in the Zope3 world with > combining large numbers of third-party products, and tweaking the > resulting highly-complex configuration, to claim that Zope3's model is > intrinsically superior to the one evolved for Zope2 + CMF. You're right, we don't. But I *do* have enough experience with the evolved one for Zope2 + CMF to know what I don't like about them. And this is one :) Philipp From chris at simplistix.co.uk Wed Jul 26 08:22:30 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 26 Jul 2006 07:22:30 +0100 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C5FCF0.90407@infrae.com> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C5FCF0.90407@infrae.com> Message-ID: <44C70A26.4050209@simplistix.co.uk> Martijn Faassen wrote: > What the right way should be for existing Zope 2 applications I do not > know. Yes, the particular problem I see is with persistent objects that have encoded strings as attributes. How did you guys manage the upgrading of existing Silva instances which were created when you still used encoded strings everywhere? > For *new* Zope 2 applications, my strong recommendation would be to > store human-readable text as unicode, and if your text is stored > externally (file, rdb), to decode it into unicode as soon as possible > when it enters your application. Totally agreed, although I'm not sure Zope 2's publisher helps as much as it should do, and I doubt any of the Zope DA's are focused this way :-S Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From faassen at infrae.com Wed Jul 26 13:23:15 2006 From: faassen at infrae.com (Martijn Faassen) Date: Wed, 26 Jul 2006 13:23:15 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <44C70A26.4050209@simplistix.co.uk> References: <44B3D5D1.2010603@simplistix.co.uk> <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C5FCF0.90407@infrae.com> <44C70A26.4050209@simplistix.co.uk> Message-ID: <44C750A3.2090607@infrae.com> Chris Withers wrote: > Martijn Faassen wrote: >> What the right way should be for existing Zope 2 applications I do not >> know. > > Yes, the particular problem I see is with persistent objects that have > encoded strings as attributes. How did you guys manage the upgrading of > existing Silva instances which were created when you still used encoded > strings everywhere? Pain, lots of sustained pain. Lots of upgrade scripts. Luckily lots of Silva content is stored in XML which does get encoding right from th start. Anyway, we had so much pain that in retrospect I sometimes think we could've stuck to UTF-8 and just lived with that, even though it wasn't the proper way for Python. When the pain was finally over, we started using PlacelessTranslationService and we got new, more subtle pain... We did this relatively early in the life of Silva, which reduced the pain somewhat as there were less instances to worry about. First half of 2003 I think -- we were there early. I suspect it'd be *incredibly* painful for Plone to do any transition in its current stage of development... Anyway, we did get some gain from the pain in that we can use Five i18n without unicode issues. We also know that text stored in Silva is going to be in unicode which helps with the XML export logic and such. >> For *new* Zope 2 applications, my strong recommendation would be to >> store human-readable text as unicode, and if your text is stored >> externally (file, rdb), to decode it into unicode as soon as possible >> when it enters your application. > > Totally agreed, although I'm not sure Zope 2's publisher helps as much > as it should do, and I doubt any of the Zope DA's are focused this way :-S I haven't had much issue with the publisher - you need to set the response header to UTF-8 and it will automatically translate unicode output to UTF-8. The DA's are more troubling, though we've been exploring relational/object mappers (SQLObject, SQL Alchemy), which have mechanisms to deal with this. Zope 3's DA's also take care of unicode at the DA level, so we could use those in Zope 2 that might take care of that. Regards, Martijn From maciej.wisniowski at coig.katowice.pl Wed Jul 26 13:52:47 2006 From: maciej.wisniowski at coig.katowice.pl (=?UTF-8?B?TWFjaWVqIFdpxZtuaW93c2tp?=) Date: Wed, 26 Jul 2006 13:52:47 +0200 Subject: [z3-five] Question about skins usage In-Reply-To: <44C61B3D.1090709@weitershausen.de> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <44C608F9.7040607@coig.katowice.pl> <44C60AAC.7040102@weitershausen.de> <44C617D9.2080402@coig.katowice.pl> <44C61B3D.1090709@weitershausen.de> Message-ID: <44C7578F.1070905@coig.katowice.pl> >Shrug! Don't mess with the traversal name stack. Simply use >IMySkin.providedBy(request) for checking whether the request has your >skin and zope.app.publisher.browser.applySkin(request, IMySkin) for >applying the skin to the request. > > It took me some time to find out how to define skins as interfaces etc. but finally I did this and it works :) My hook is defined as: def __before_publishing_traverse__(self, object, REQUEST): """ Pre-traversal hook. """ if not XYZSkin.providedBy(REQUEST): applySkin(REQUEST, XYZSkin) One more question is whether I can/should use LocalSites here? For the others who want to do something like me or simply write a skin with Five I'll write few things that should save you some time, I hope... Look at: /lib/python/zope/app/rotterdam # skin which (at last in Zope 2.9.4) # is defined in new way (with interfaces) # and can be used as template /lib/python/zope/app/publisher/browser/metadirectives.py # interfaces with good docs # about their use and http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/SimplifySkinning which is a proposal so it differs a bit in some places than eg. rotterdam implementation. -- Maciej Wisniowski From regebro at gmail.com Wed Jul 26 14:10:16 2006 From: regebro at gmail.com (Lennart Regebro) Date: Wed, 26 Jul 2006 14:10:16 +0200 Subject: [z3-five] Deprecating the old local site support In-Reply-To: <319e029f0607260043g4bb3d2dr1a0b0729581e4596@mail.gmail.com> References: <319e029f0607250722v43fd6401u40e756052586d438@mail.gmail.com> <44C6A9BE.8020804@weitershausen.de> <319e029f0607260043g4bb3d2dr1a0b0729581e4596@mail.gmail.com> Message-ID: <319e029f0607260510w4d60e44co92d5dcfc7f3de511@mail.gmail.com> On 7/26/06, Lennart Regebro wrote: > Geez. I'm sleepy or something. I ment *for* 2.11. :-) That is *removing it* in 2.11. But it might be possible that we can improve compatibility, in steps. I did some quick tests, and I think it would be possible to have Five.site be just a thin layer on top of Five.component. However, the same incompatibilities arise. So new plan: We keep Five.site around in 2.10, for backwards compatibility with 2.9. This means that if you have only software made for Five.component, you use it. If you have software *only* made for Five.site, you use it. If you have software made for both, you either convert Five.site usage to Five.component, or you use Five.site. Five.site *should* work with Five.component software as well, but it's hard to test that extensively. Local utility usage should be compatible over Five 1.2, 1.3, 1.4 and Zope 2.10. In Zope 2.11, Five.site gets refactored to be a thin layer around Five.component. Software written for Five.site may have to be changed a bit. Mainly, utilities will no longer be aq_wrapped. The interfaces stay the same, though. Software that assumes utilities are wrapped will need modification for usage with 2.11, but after that modification, it will still be useable with Five 1.2, 1.3, 1.4, Zope 2.10 and Zope 2.11. In Zope 2.12, Five site gets *Baleeted!* and everybody is happy. :) If you still use Five.site at that point, you will need to change the site creation and utility registration, and it will then work with 2.10, 2.11 and 2.12, but no longer with 2.8 and 2.9. Howzat? -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From tseaver at palladion.com Wed Jul 26 14:24:55 2006 From: tseaver at palladion.com (Tres Seaver) Date: Wed, 26 Jul 2006 08:24:55 -0400 Subject: [z3-five] Question about skins usage In-Reply-To: <44C70911.7030704@weitershausen.de> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <20060725142534.GB9857@slinkp.com> <44C64031.9030908@palladion.com> <44C6A851.9080006@weitershausen.de> <44C6C071.20700@palladion.com> <44C70911.7030704@weitershausen.de> Message-ID: <44C75F17.3070308@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Philipp von Weitershausen wrote: > Tres Seaver wrote: >> Philipp von Weitershausen wrote: >>>> Tres Seaver wrote: >>>>> Paul Winkler wrote: >>>>>>> On Tue, Jul 25, 2006 at 01:47:16PM +0200, Philipp von Weitershausen wrote: >>>>>>>> Why? The one-layer-per-product rule from the CMF is pretty stupid. >>>>>>> Which rule is that? My old CMF code frequently used multiple layers. >>>>> Hmmm, maybe Philipp doesn't really believe in layers? The original >>>>> point of layering was to allow reuse-with-override; later, the layers >>>>> became a way to organize "related" skin objects on disk. If you aren't >>>>> trying for those goals, then layers are definitely overhead you don't need. >>>> I do like layers. What I don't like is a common pattern in CMF, or >>>> rather, in extension products for the CMF which makes up for the missing >>>> "default" layer in the CMF. >> Its absence is *by design* (see below). > > That's almost hard to believe (though surely not impossible). I would > have guessed it's as much "by design" as the big flat namespace in the > CMF is by design (which yields to view names like document_edit_form and > document_view instead of just edit and view). Surely *somebody* made the > CMF use implicit acquisition throughout... that doesn't mean it was a > "design choice". The "design choice" is tha product authors are not encouraged to feel that they own the "polciy space": when you add a product to a Zope2 + CMF instance, *nothing happens* until the site owner chooses to incorporate the skins (and other policy choices, like types, workflows, etc.) into her site. Those choices can all be made discretely, if she wishes, althogh the QuickInstaller provides a "just do it" way to short circuit making those choices for many. Even in the case of the QuickInstaller-driven site, it is feasible to *override* the presents after doing the install (e.g., to move a laywer "down" in the stack, or delete it altogether from a skin). The "flat acquisition namespace" for skin objects is an entirely different problem, for which Zope3's view mechanism is the obvious remedy. In Zope3, the policy choice is essentially all or nothing: you either include the package's ZCML slug, or you copy its configuration wholesale and hack on the copy. Most add-on authors (and much of the core!) do not factor their ZCML in ways that would ease this (i.e., by splitting directives up into fragments built around granularity of reuse). ZCML itself allows for only the crudest override mechanism. I actually argued *long* ago (December 2001, after the first ZC-internal Zope3 sprint) that the directive in ZCML (it was spelled differently then) should allow for nested subdirectives which controlled *how* the included file's actions were processed. In particular, I wanted individual directives in the included file to be excludable based on their 'id' attributes, e.g.:: This "proposal" obviously requires that parsing a ZCML file be free of side-effects, which was why Jim and Shane vetoed it at the time. Of course, the fact is that side-effect-free ZCML parsing would be a big win for other purposes, too. > I don't question the flexibility and usefulness of all this. I'm still a > fan of layers, but I also think they're just overdone in the CMF. You > have to jump through lots of hoops just to get a simple view Page > Template publishable from the filesystem. And of all, the common install > 'trick' that monkeys with all existing skins so that they include the > new layer turns my stomach... > > Of course, having a "default" layer doesn't mean you can't do all this > in Zope 3. If you deliberately put all the stuff from different packages > in different layers, you basically end up with what the CMF has got. It > just doesn't seem common practice... (and I think I know why: nobody > needs it). > > As for granularity of configuration, I think we could be making use of > zcml:condition a lot more to make thigns more flexible. Surely, 3rd > party packages that want to be very flexible (e.g. the CMF) can > encourage its usage. I don't think ZCML's condition bit puts the responsibility in the right place: the "mechanism" (the included file) ends up enforcing "policy" signalled by way of some global variable. I'd rather "pull" mechanism into policy selectively, than "push" policy into mechanism. >>>> I find layers useful, but only in one context: producing skins. The >>>> "default" layer has no skinning, that's what specialized layers are for. >>>> I'd say 99% of the things I would put on a layer other than the default >>>> one is skin-related (skin macro, resources like logo images, CSS, >>>> JavaScript, etc.). >> I don't think we have enough experience in the Zope3 world with >> combining large numbers of third-party products, and tweaking the >> resulting highly-complex configuration, to claim that Zope3's model is >> intrinsically superior to the one evolved for Zope2 + CMF. > > You're right, we don't. But I *do* have enough experience with the > evolved one for Zope2 + CMF to know what I don't like about them. And > this is one :) Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEx18X+gerLs4ltQ4RAhRxAJ9o2IvXohyMz/yHnNy/z7Qb+018SgCeJLaB kPS1QIe/7heO+uA9zSb7u+c= =1AcG -----END PGP SIGNATURE----- From r.ritz at biologie.hu-berlin.de Wed Jul 26 17:30:55 2006 From: r.ritz at biologie.hu-berlin.de (Raphael Ritz) Date: Wed, 26 Jul 2006 17:30:55 +0200 Subject: [z3-five] unicodes and strings in Zope 2.9's ZPT with Zope 3's i18n In-Reply-To: <20060725142152.GA9857@slinkp.com> References: <319e029f0607111029y6d87906avce6fad2ab2a5a0e1@mail.gmail.com> <44B3E3C0.3040806@simplistix.co.uk> <44B3F32F.2030002@simplistix.co.uk> <44B6B1A5.8050800@weitershausen.de> <44BE5265.6030801@simplistix.co.uk> <44C0EB61.1020206@simplistix.co.uk> <44C3571B.5070801@coig.katowice.pl> <44C45F1B.3030101@onego.ru> <44C476B4.20209@coig.katowice.pl> <44C5D64D.7000808@weitershausen.de> <20060725142152.GA9857@slinkp.com> Message-ID: Paul Winkler schrieb: > On Tue, Jul 25, 2006 at 10:29:01AM +0200, Philipp von Weitershausen wrote: >> Maciej Wi??niowski wrote: >>> But is more difficult especially for begineers >> It's pretty easy, I think. Most people just don't explain it well enough. > > Recommended reading: > http://www.joelonsoftware.com/articles/Unicode.html > and while we are at this: I also found http://www.amk.ca/python/howto/unicode to be very illustrative. Raphael From apm13 at columbia.edu Wed Jul 26 17:54:02 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Wed, 26 Jul 2006 08:54:02 -0700 Subject: [z3-five] SVN: Products.Five/branches/1.4/ Backported the traversal order changes from zope 2.10 In-Reply-To: <44C686D2.2050600@wcm-solutions.de> References: <20060713234801.BEB892032C8@mail.zope.org> <44C686D2.2050600@wcm-solutions.de> Message-ID: <365118370607260854h5e8c053cl583371ae672cdec9@mail.gmail.com> On 7/25/06, yuppie wrote: > Hi! > > > Alec Mitchell wrote: > > Log message for revision 69121: > > Backported the traversal order changes from zope 2.10 > > There's a bug in that change. HEAD requests (and I guess also other > FTP/WebDAV requests) trigger this error: > > ERROR Zope.SiteErrorLog http://www.example.org/mySite/virtual_hosting// > Traceback (innermost last): > Module ZPublisher.Publish, line 106, in publish > Module ZPublisher.BaseRequest, line 325, in traverse > Module webdav.NullResource, line 66, in __bobo_traverse__ > NotFound: The requested resource was not found. > > The VirtualHostMonster adds 'virtual_hosting//' to the URL (don't ask me > why). 'virtual_hosting' has to be acquired, but now a NullResource is > created instead. Hm, this is a bit puzzling. The code should use acquisition if there's no available view and if the attribute is not available via item lookup. Perhaps the context[attr] lookup is returning a NullResource? If this is the case, doesn't the same problem exist in Zope 2.10? Is this true for any HEAD request that includes an acquired attribute, or just those that go through the VHM? Thanks, Alec From philipp at weitershausen.de Wed Jul 26 20:01:08 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 26 Jul 2006 20:01:08 +0200 Subject: [z3-five] Deprecating the old local site support In-Reply-To: <319e029f0607260510w4d60e44co92d5dcfc7f3de511@mail.gmail.com> References: <319e029f0607250722v43fd6401u40e756052586d438@mail.gmail.com> <44C6A9BE.8020804@weitershausen.de> <319e029f0607260043g4bb3d2dr1a0b0729581e4596@mail.gmail.com> <319e029f0607260510w4d60e44co92d5dcfc7f3de511@mail.gmail.com> Message-ID: <44C7ADE4.1090200@weitershausen.de> Lennart Regebro wrote: > On 7/26/06, Lennart Regebro wrote: >> Geez. I'm sleepy or something. I ment *for* 2.11. :-) > > That is *removing it* in 2.11. But it might be possible that we can > improve compatibility, in steps. > > I did some quick tests, and I think it would be possible to have > Five.site be just a thin layer on top of Five.component. That's cool. > However, the same incompatibilities arise. I suspect you're talking about the acquisition wrapping of utilities. I think that we really want persistent local utilities to be acquisition wrapped in Zope 2, perhaps because of security, but probably also because of the migration path ahead: if CMF tools become Zope 3 utilities, we can't ditch aquisition. I suspect CMF tools heavily depend on being able to acquire things. Here's what I suggest: Five.component will supply new component registry called PersistentAcquiredComponents. It will inherit from zope.component.persistentregistry.PersistentComponents and basically just always return the thing they're looking up with an acquisition context IF the thing they found supports acquisition. Basically, each of their method will be: def querySomething(self, *args, **kwargs): ob = super(...).querySomething(*args, **kwargs) if hasattr(ob, '__of__'): return ob.__of__(self.__parent__) return ob (the generators look a bit more complicated, but use the same princple) This requires PersistentAcquiredComponents to have a __parent__ attribute which will point to the site that it's associated with. So, basically, when making a new site, you will do: >>> sm = PersistentAcquiredComponents(possible_site) >>> possible_site.setSiteManager(sm) >>> alsoProvides(possible_site, ISite) > We keep Five.site around in 2.10, for backwards compatibility with > 2.9. This means that if you have only software made for > Five.component, you use it. If you have software *only* made for > Five.site, you use it. If you have software made for both, you either > convert Five.site usage to Five.component, or you use Five.site. > Five.site *should* work with Five.component software as well, but it's > hard to test that extensively. Local utility usage should be > compatible over Five 1.2, 1.3, 1.4 and Zope 2.10. > > In Zope 2.11, Five.site gets refactored to be a thin layer around > Five.component. That'd be good. > Software written for Five.site may have to be changed > a bit. Mainly, utilities will no longer be aq_wrapped. I think that'd be a BBB foul. Instead of simply dropping aq_wrapping, I think we should actually support it, even in Five.component. > The interfaces stay the same, though. That's awesome. > In Zope 2.12, Five site gets *Baleeted!* and everybody is happy. :) In Zope 2.13 you mean. We haven't issued deprecation warnings for Five.site yet... Philipp From y.2006_ at wcm-solutions.de Wed Jul 26 21:48:18 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Wed, 26 Jul 2006 21:48:18 +0200 Subject: [z3-five] SVN: Products.Five/branches/1.4/ Backported the traversal order changes from zope 2.10 In-Reply-To: <365118370607260854h5e8c053cl583371ae672cdec9@mail.gmail.com> References: <20060713234801.BEB892032C8@mail.zope.org> <44C686D2.2050600@wcm-solutions.de> <365118370607260854h5e8c053cl583371ae672cdec9@mail.gmail.com> Message-ID: <44C7C702.7010407@wcm-solutions.de> Hi Alec! Alec Mitchell wrote: > On 7/25/06, yuppie wrote: >> Alec Mitchell wrote: >>> Log message for revision 69121: >>> Backported the traversal order changes from zope 2.10 >> There's a bug in that change. HEAD requests (and I guess also other >> FTP/WebDAV requests) trigger this error: >> >> ERROR Zope.SiteErrorLog http://www.example.org/mySite/virtual_hosting// >> Traceback (innermost last): >> Module ZPublisher.Publish, line 106, in publish >> Module ZPublisher.BaseRequest, line 325, in traverse >> Module webdav.NullResource, line 66, in __bobo_traverse__ >> NotFound: The requested resource was not found. >> >> The VirtualHostMonster adds 'virtual_hosting//' to the URL (don't ask me >> why). 'virtual_hosting' has to be acquired, but now a NullResource is >> created instead. > > Hm, this is a bit puzzling. The code should use acquisition if > there's no available view and if the attribute is not available via > item lookup. Perhaps the context[attr] lookup is returning a > NullResource? Don't know. I did no further debugging. All I know is that reverting your change fixes this issue. It already took me some time to find that out. > If this is the case, doesn't the same problem exist in > Zope 2.10? Zope 2.10 has the same issue but produces a different traceback: ERROR Zope.SiteErrorLog http://www.example.org/mySite/virtual_hosting// Traceback (innermost last): Module ZPublisher.Publish, line 106, in publish Module ZPublisher.BaseRequest, line 463, in traverse Module ZPublisher.BaseRequest, line 318, in traverseName Module ZPublisher.BaseRequest, line 114, in publishTraverse NotFound: The requested resource was not found. > Is this true for any HEAD request that includes an > acquired attribute, or just those that go through the VHM? Same problem with other acquired attributes. This is the Zope 2.10 error: ERROR Zope.SiteErrorLog http://localhost:8080/mySite/foo/HEAD 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 webdav.NullResource, line 74, in HEAD NotFound: The requested resource does not exist. BTW: I used wget for testing this, --spider triggers a HEAD request. wget --spider localhost:8080/VirtualHostBase/http/www.example.org:80/mySite/VirtualHostRoot/ Cheers, Yuppie From fairwinds at eastlink.ca Wed Jul 26 23:05:22 2006 From: fairwinds at eastlink.ca (David Pratt) Date: Wed, 26 Jul 2006 18:05:22 -0300 Subject: [z3-five] Question about skins usage In-Reply-To: <44C61B3D.1090709@weitershausen.de> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <44C608F9.7040607@coig.katowice.pl> <44C60AAC.7040102@weitershausen.de> <44C617D9.2080402@coig.katowice.pl> <44C61B3D.1090709@weitershausen.de> Message-ID: <44C7D912.3060306@eastlink.ca> Hi Philip. I had posted to the Z3 list a question about role based skinning. From this post it seems that all that is necessary is to obtain member role from request and use a traversal hook as you have suggested. The use case I have in mind is to present an admin skin for administrators of a site and a different skin to regular consumers of the site. On another note, one thing I have appreciated with django is a means to construct urls in a sensible way. I'd like to better understand an approach to constructing urls in zope 3 that are not necessarily based on objects not being in a specific container. A blog url example is a good one to use for this. For a blog you may have a container for blog entries and then the blog entries themselves but you may want the articles to be reached like: * Accessing /blog/ will show a list of all posts by reverse date order * Accessing /blog//, eg /blog/2006/ will show a listing of posts for just that year. * Accessing /blog///, eg /blog/2006/12/ will show a listing of posts for that month. * Accessing /blog////, eg /blog/2006/12/20/ will show all postings on that particular day * Accessing /blog////
will show a particular article. Can you explain an approach to accomplish something similar in zope3. Many thanks. Regards, David Philipp von Weitershausen wrote: > Maciej Wi?niowski wrote: >>> Will they get different domains? Then you can use rewrite rules: >>> >>> www.car-shop.com -> http://localhost:8080/++skin++CarShop/carshop >>> www.usedcars.com -> http://localhost:8080/++skin++UsedCars/usedcars >>> >>> If they are part of the same domain, use traversal hooks as described >>> above (www.car-shop.com vs. www.car-shop.com/usecars). >>> >>> >> We have many environments for our applications (developement, testing, >> learning etc.) >> so I think traversal hooks are better choice. I've never played with >> them but >> seems that I have to add something like: >> >> def __before_publishing_traverse__(self, object, REQUEST): >> """ Pre-traversal hook. >> """ >> # check if there is no skin already and >> # add/modify a skin to REQUEST['TraversalRequestNameStack'] or >> REQUEST.path > > Shrug! Don't mess with the traversal name stack. Simply use > IMySkin.providedBy(request) for checking whether the request has your > skin and zope.app.publisher.browser.applySkin(request, IMySkin) for > applying the skin to the request. > > Remember: Skins are just interfaces (that provide ISkin). > > Philipp > > _______________________________________________ > z3-five mailing list > z3-five at codespeak.net > http://codespeak.net/mailman/listinfo/z3-five From morten at nidelven-it.no Thu Jul 27 16:07:37 2006 From: morten at nidelven-it.no (Morten W. Petersen) Date: Thu, 27 Jul 2006 16:07:37 +0200 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed Message-ID: <44C8C8A9.9030901@nidelven-it.no> Hi, I'm running some custom products (nothing fancy) on Plone 2.5 with Five and other things. The following message appears every now and then; I tried asking for help on plone-users but nobody replied, and seeing that Five is involved in the traceback I thought I'd ask here. Anyone know what's going on? * Module ZPublisher.Publish, line 115, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 41, in call_object * Module Shared.DC.Scripts.Bindings, line 311, in __call__ * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec * Module Products.CMFCore.FSPageTemplate, line 195, in _exec * Module Products.CMFCore.FSPageTemplate, line 134, in pt_render * Module Products.PageTemplates.PageTemplate, line 104, in pt_render * Module TAL.TALInterpreter, line 238, in __call__ * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 749, in do_useMacro * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 457, in do_optTag_tal * Module TAL.TALInterpreter, line 442, in do_optTag * Module TAL.TALInterpreter, line 437, in no_tag * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 780, in do_defineSlot * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 457, in do_optTag_tal * Module TAL.TALInterpreter, line 442, in do_optTag * Module TAL.TALInterpreter, line 437, in no_tag * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 728, in do_defineMacro * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 715, in do_condition * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 457, in do_optTag_tal * Module TAL.TALInterpreter, line 442, in do_optTag * Module TAL.TALInterpreter, line 437, in no_tag * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 749, in do_useMacro * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 749, in do_useMacro * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 457, in do_optTag_tal * Module TAL.TALInterpreter, line 442, in do_optTag * Module TAL.TALInterpreter, line 437, in no_tag * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 715, in do_condition * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 715, in do_condition * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 457, in do_optTag_tal * Module TAL.TALInterpreter, line 442, in do_optTag * Module TAL.TALInterpreter, line 437, in no_tag * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 507, in do_setLocal_tal * Module Products.PageTemplates.TALES, line 221, in evaluate URL: file:CMFPlone/skins/plone_templates/global_contentmenu.pt Line 82, Column 4 Expression: standard:'addContext/getAllowedTypes' Names: {'container': , 'context': , 'default': , 'here': , 'loop': , 'modules': , 'nothing': None, 'options': {'args': ()}, 'repeat': , 'request': , 'root': , 'template': , 'traverse_subpath': [], 'user': } * Module Products.PageTemplates.Expressions, line 185, in __call__ * Module Products.PageTemplates.Expressions, line 180, in _eval * Module Products.PageTemplates.Expressions, line 77, in render * Module Products.PageTemplates.ZRPythonExpr, line 76, in call_with_ns * Module Products.CMFCore.FSPythonScript, line 103, in __render_with_namespace__ * Module Shared.DC.Scripts.Bindings, line 325, in __render_with_namespace__ * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec * Module Products.CMFCore.FSPythonScript, line 164, in _exec * Module None, line 2, in getAllowedTypes Line 2 * Module Products.ATContentTypes.lib.constraintypes, line 268, in allowedContentTypes * Module Products.CMFCore.PortalFolder, line 157, in allowedContentTypes * Module Products.CMFCore.TypesTool, line 886, in listTypeInfo * Module Products.CMFCore.TypesTool, line 555, in isConstructionAllowed * Module Products.CMFCore.TypesTool, line 527, in _queryFactoryMethod * Module App.FactoryDispatcher, line 26, in __getitem__ * Module Products.Five.pythonproducts, line 103, in __bobo_traverse__ * Module Products.Five.pythonproducts, line 73, in product_packages * Module ZODB.Connection, line 729, in setstate From y.2006_ at wcm-solutions.de Thu Jul 27 18:27:17 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Thu, 27 Jul 2006 18:27:17 +0200 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <44C8C8A9.9030901@nidelven-it.no> References: <44C8C8A9.9030901@nidelven-it.no> Message-ID: <44C8E965.2000809@wcm-solutions.de> Hi Morten! Morten W. Petersen wrote: > I'm running some custom products (nothing fancy) on Plone 2.5 with Five > and other things. > > The following message appears every now and then; I tried asking for > help on plone-users but nobody replied, and seeing that Five is involved > in the traceback I thought I'd ask here. > > Anyone know what's going on? I did have the same problem and today I applied the following patch on my server. AFAICS pythonproducts has a quite fragile way to get hold of the root object (AKA app). Index: pythonproducts.py =================================================================== --- pythonproducts.py (Revision 69227) +++ pythonproducts.py (Arbeitskopie) @@ -124,7 +124,7 @@ product=self.aq_acquire('_getProducts')()._product(name) # Try to get a custom dispatcher from a Python product - productPkgs = product_packages(app) + productPkgs = product_packages(self.getPhysicalRoot()) dispatcher_class=getattr( productPkgs.get(name, None), '__FactoryDispatcher__', You are invited to test this patch and to report back if it causes any trouble. If the patch solves the problem without creating new problems it should be checked in. Cheers, Yuppie From morten at nidelven-it.no Thu Jul 27 19:02:45 2006 From: morten at nidelven-it.no (Morten W. Petersen) Date: Thu, 27 Jul 2006 19:02:45 +0200 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <44C8E965.2000809@wcm-solutions.de> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> Message-ID: <44C8F1B5.50900@nidelven-it.no> yuppie wrote: > Hi Morten! > > > Morten W. Petersen wrote: >> I'm running some custom products (nothing fancy) on Plone 2.5 with Five >> and other things. >> >> The following message appears every now and then; I tried asking for >> help on plone-users but nobody replied, and seeing that Five is involved >> in the traceback I thought I'd ask here. >> >> Anyone know what's going on? > > I did have the same problem and today I applied the following patch on > my server. AFAICS pythonproducts has a quite fragile way to get hold of > the root object (AKA app). [...] > You are invited to test this patch and to report back if it causes any > trouble. If the patch solves the problem without creating new problems > it should be checked in. Sounds great. I'll apply the patch and see if the problem goes away. Will get back to you on that. -Morten From chris at simplistix.co.uk Thu Jul 27 22:07:59 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Thu, 27 Jul 2006 21:07:59 +0100 Subject: [z3-five] Question about skins usage In-Reply-To: <44C75F17.3070308@palladion.com> References: <44C5D40E.1000405@coig.katowice.pl> <44C604C4.8080809@weitershausen.de> <20060725142534.GB9857@slinkp.com> <44C64031.9030908@palladion.com> <44C6A851.9080006@weitershausen.de> <44C6C071.20700@palladion.com> <44C70911.7030704@weitershausen.de> <44C75F17.3070308@palladion.com> Message-ID: <44C91D1F.3090102@simplistix.co.uk> Tres Seaver wrote: > directives up into fragments built around granularity of reuse). ZCML > itself allows for only the crudest override mechanism. That's sad, one of the big selling points for ZCML was that it was going to allow fine grained overriding of configuration, such as the binding of permissions to methods, without the need to fiddle with the product itself or copy-and-hack the whole product :-/ > This "proposal" obviously requires that parsing a ZCML file be free of > side-effects, which was why Jim and Shane vetoed it at the time. Why does parsing have side effects? Surely that's almost as bad as importing a python package having side effects? *grunt* Oh well, I won't be able to contribute to this discussion for a few weeks, I hope it pans out well :-/ Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From morten at nidelven-it.no Fri Jul 28 00:05:05 2006 From: morten at nidelven-it.no (Morten W. Petersen) Date: Fri, 28 Jul 2006 00:05:05 +0200 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <44C8E965.2000809@wcm-solutions.de> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> Message-ID: <44C93891.1030905@nidelven-it.no> Looks like it is working! Thank you very much Yuppie, this was a showstopper.. -Morten yuppie wrote: > Hi Morten! > > > Morten W. Petersen wrote: >> I'm running some custom products (nothing fancy) on Plone 2.5 with Five >> and other things. >> >> The following message appears every now and then; I tried asking for >> help on plone-users but nobody replied, and seeing that Five is involved >> in the traceback I thought I'd ask here. >> >> Anyone know what's going on? > > I did have the same problem and today I applied the following patch on > my server. AFAICS pythonproducts has a quite fragile way to get hold of > the root object (AKA app). > > Index: pythonproducts.py > =================================================================== > --- pythonproducts.py (Revision 69227) > +++ pythonproducts.py (Arbeitskopie) > @@ -124,7 +124,7 @@ > product=self.aq_acquire('_getProducts')()._product(name) > > # Try to get a custom dispatcher from a Python product > - productPkgs = product_packages(app) > + productPkgs = product_packages(self.getPhysicalRoot()) > dispatcher_class=getattr( > productPkgs.get(name, None), > '__FactoryDispatcher__', > > > You are invited to test this patch and to report back if it causes any > trouble. If the patch solves the problem without creating new problems > it should be checked in. > > > Cheers, > > Yuppie > From philipp at weitershausen.de Sat Jul 29 20:26:48 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Sat, 29 Jul 2006 20:26:48 +0200 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <44C8E965.2000809@wcm-solutions.de> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> Message-ID: <44CBA868.9090005@weitershausen.de> yuppie wrote: > Index: pythonproducts.py > =================================================================== > --- pythonproducts.py (Revision 69227) > +++ pythonproducts.py (Arbeitskopie) > @@ -124,7 +124,7 @@ > product=self.aq_acquire('_getProducts')()._product(name) > > # Try to get a custom dispatcher from a Python product > - productPkgs = product_packages(app) > + productPkgs = product_packages(self.getPhysicalRoot()) > dispatcher_class=getattr( > productPkgs.get(name, None), > '__FactoryDispatcher__', > > > You are invited to test this patch and to report back if it causes any > trouble. If the patch solves the problem without creating new problems > it should be checked in. Seems like the patch has been verified to work. Yuppie, Rocky, ...? Philipp From rocky at serverzen.com Sun Jul 30 00:09:29 2006 From: rocky at serverzen.com (Rocky Burt) Date: Sat, 29 Jul 2006 19:39:29 -0230 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <44CBA868.9090005@weitershausen.de> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> <44CBA868.9090005@weitershausen.de> Message-ID: <1154210957.27651.1.camel@localhost> On Sat, 2006-29-07 at 20:26 +0200, Philipp von Weitershausen wrote: > yuppie wrote: > > Index: pythonproducts.py > > =================================================================== > > --- pythonproducts.py (Revision 69227) > > +++ pythonproducts.py (Arbeitskopie) > > @@ -124,7 +124,7 @@ > > product=self.aq_acquire('_getProducts')()._product(name) > > > > # Try to get a custom dispatcher from a Python product > > - productPkgs = product_packages(app) > > + productPkgs = product_packages(self.getPhysicalRoot()) > > dispatcher_class=getattr( > > productPkgs.get(name, None), > > '__FactoryDispatcher__', > > > > > > You are invited to test this patch and to report back if it causes any > > trouble. If the patch solves the problem without creating new problems > > it should be checked in. > > Seems like the patch has been verified to work. Yuppie, Rocky, ...? Hmm, I seem to recall trying something like this and the tests failing. If the tests pass I'd say its a decent short-term patch. But realistically I should update the application context handling a bit better in general. Thankfully this support isn't needed with Five 1.5. Regards, 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060729/87a0a380/attachment.pgp From y.2006_ at wcm-solutions.de Sun Jul 30 20:45:54 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Sun, 30 Jul 2006 20:45:54 +0200 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <1154210957.27651.1.camel@localhost> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> <44CBA868.9090005@weitershausen.de> <1154210957.27651.1.camel@localhost> Message-ID: <44CCFE62.4@wcm-solutions.de> Hi Rocky! Rocky Burt wrote: > On Sat, 2006-29-07 at 20:26 +0200, Philipp von Weitershausen wrote: >> yuppie wrote: >>> Index: pythonproducts.py >>> =================================================================== >>> --- pythonproducts.py (Revision 69227) >>> +++ pythonproducts.py (Arbeitskopie) >>> @@ -124,7 +124,7 @@ >>> product=self.aq_acquire('_getProducts')()._product(name) >>> >>> # Try to get a custom dispatcher from a Python product >>> - productPkgs = product_packages(app) >>> + productPkgs = product_packages(self.getPhysicalRoot()) >>> dispatcher_class=getattr( >>> productPkgs.get(name, None), >>> '__FactoryDispatcher__', >>> >>> >>> You are invited to test this patch and to report back if it causes any >>> trouble. If the patch solves the problem without creating new problems >>> it should be checked in. >> Seems like the patch has been verified to work. Yuppie, Rocky, ...? > > Hmm, I seem to recall trying something like this and the tests failing. > If the tests pass I'd say its a decent short-term patch. But > realistically I should update the application context handling a bit > better in general. Thankfully this support isn't needed with Five 1.5. I don't understand your last sentence. AFAICS this support was just partly moved from Five to Zope and is still needed. I was not aware of the fact that Zope 2.10 uses a different implementation. After looking at that code I have the impression that you just forgot to backport the new code to Five 1.4. The Five 1.5 and Zope 2.10 code looks much better than the broken code in Five 1.4. My patch doesn't remove all dependencies on the nasty _zope_app variable. I choose getPhysicalRoot() because I'm not sure how expensive it is to open a new connection. But Zope2.app() as used in Zope 2.10 works as well and I can't see a reason for a short-term solution that is different. Cheers, Yuppie From rocky at serverzen.com Sun Jul 30 21:03:05 2006 From: rocky at serverzen.com (Rocky Burt) Date: Sun, 30 Jul 2006 16:33:05 -0230 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <44CCFE62.4@wcm-solutions.de> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> <44CBA868.9090005@weitershausen.de> <1154210957.27651.1.camel@localhost> <44CCFE62.4@wcm-solutions.de> Message-ID: <1154286165.27651.21.camel@localhost> Hi Yuppie, On Sun, 2006-30-07 at 20:45 +0200, yuppie wrote: > Hi Rocky! > > > Rocky Burt wrote: > > On Sat, 2006-29-07 at 20:26 +0200, Philipp von Weitershausen wrote: > >> yuppie wrote: > >>> Index: pythonproducts.py > >>> =================================================================== > >>> --- pythonproducts.py (Revision 69227) > >>> +++ pythonproducts.py (Arbeitskopie) > >>> @@ -124,7 +124,7 @@ > >>> product=self.aq_acquire('_getProducts')()._product(name) > >>> > >>> # Try to get a custom dispatcher from a Python product > >>> - productPkgs = product_packages(app) > >>> + productPkgs = product_packages(self.getPhysicalRoot()) > >>> dispatcher_class=getattr( > >>> productPkgs.get(name, None), > >>> '__FactoryDispatcher__', > >>> > >>> > >>> You are invited to test this patch and to report back if it causes any > >>> trouble. If the patch solves the problem without creating new problems > >>> it should be checked in. > >> Seems like the patch has been verified to work. Yuppie, Rocky, ...? > > > > Hmm, I seem to recall trying something like this and the tests failing. > > If the tests pass I'd say its a decent short-term patch. But > > realistically I should update the application context handling a bit > > better in general. Thankfully this support isn't needed with Five 1.5. > > I don't understand your last sentence. AFAICS this support was just > partly moved from Five to Zope and is still needed. > > I was not aware of the fact that Zope 2.10 uses a different > implementation. After looking at that code I have the impression that > you just forgot to backport the new code to Five 1.4. The Five 1.5 and > Zope 2.10 code looks much better than the broken code in Five 1.4. My > patch doesn't remove all dependencies on the nasty _zope_app variable. > > I choose getPhysicalRoot() because I'm not sure how expensive it is to > open a new connection. But Zope2.app() as used in Zope 2.10 works as > well and I can't see a reason for a short-term solution that is different. I implemented the support in Five 1.4 first. Then later on I implemented it into zope 2.10 after I had gained a bit more experience. The approach I used in zope 2.10 was cleaner, indeed ... but I didn't realize the approach used in Five 1.4 would cause problems. Basically you're right, I need to backport the approach from Zope 2.10 into Five 1.4. The problem is that right now I'm in the middle of a move and its hard for me to do anything beyond a tiny bit of client work. I will get to this eventually though. Unless of course some brave soul wants to do it first :) - 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060730/17199689/attachment.pgp From usenet at diefenba.ch Fri Aug 4 07:34:15 2006 From: usenet at diefenba.ch (Kai Diefenbach) Date: Fri, 4 Aug 2006 07:34:15 +0200 Subject: [z3-five] Events / Archetypes Message-ID: <1hjjaps.yclf541v7nh1cN%usenet@diefenba.ch> Hello, Trying out Zope 3 events I experienced unexpected behaviour. Maybe someone can help out. I'm using Zope-2.9.4 and Plone 2.5. Situation: There is a simple content type using Archetypes, which has a few fields, e.g. text. This content type implements IComment. There are simple event subscribers: from Products.CMFCore.utils import getToolByName def notifyAdd(comment, event): """ """ sendMail("Added Comment", entry.text) # text is empty def changeStatus(comment, event): """ """ wftool = getToolByName(comment, "portal_workflow") wftool.doActionFor(comment, "publish") And the configure.zcml is: Now the subscribers are called indeed, but all fields of the comment are empty, that means, within notifyAdd comment.text is "" and comment.getText() throws a AttributeError. After processing changeStatus the *history* of the comment object says it was published but the real state is still visible. Thanks Kai From anton at headnet.dk Fri Aug 4 13:49:03 2006 From: anton at headnet.dk (Anton Stonor) Date: Fri, 04 Aug 2006 13:49:03 +0200 Subject: [z3-five] Events / Archetypes In-Reply-To: <1hjjaps.yclf541v7nh1cN%usenet@diefenba.ch> References: <1hjjaps.yclf541v7nh1cN%usenet@diefenba.ch> Message-ID: <44D3342F.2080703@headnet.dk> Kai Diefenbach wrote: > Trying out Zope 3 events I experienced unexpected behaviour. Maybe > someone can help out. I'm using Zope-2.9.4 and Plone 2.5. I'm no zope 3 event expert, but this behavior might be caused by the fact that decent event support has not been landed for Plone/Archetypes yet (as far as I know). What has been implemented in Zope 2.9 is basic z3 events for Zope containers. And since Archetypes object creation is kind-of-broken it might lead to unexpected behavior. When I tried the IObjectAddedEvent event with a ATDocument, the event handler was called 4 times (!) in a row when adding a single object. It is probably more safe to use the at_post_create_script or at_post_edit_script hooks. This branch adds event support to the at_post_edit_script: http://dev.plone.org/archetypes/browser/Archetypes/branches/plip_145_TTWLocking /Anton From optilude at gmx.net Fri Aug 4 21:21:50 2006 From: optilude at gmx.net (Martin Aspeli) Date: Fri, 04 Aug 2006 20:21:50 +0100 Subject: [z3-five] Events / Archetypes In-Reply-To: <1hjjaps.yclf541v7nh1cN%usenet@diefenba.ch> References: <1hjjaps.yclf541v7nh1cN%usenet@diefenba.ch> Message-ID: Kai Diefenbach wrote: > Now the subscribers are called indeed, but all fields of the comment are > empty, that means, within notifyAdd comment.text is "" and > comment.getText() throws a AttributeError. I believe IObjectAddedEvent happens as soon as the object is created. Note that in CMF terms, this means as soon as you hit the "add item" link, so even if it's created in portal_factory, it's still created. In other words, you're getting the event before base_edit's Save button has been clicked. Martin From philipp at weitershausen.de Sun Aug 13 22:59:55 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Sun, 13 Aug 2006 22:59:55 +0200 Subject: [z3-five] Five release fest: Five 1.2.6, 1.3.7, 1.4.1, 1.5 released Message-ID: <44DF92CB.8030005@weitershausen.de> The Five team is happy to announce the release of four Five stable releases today! What is Five ------------ Five is a Zope 2 product that allows you to integrate Zope 3 technologies into Zope 2, today. Among others, it allows you to use Zope 3 interfaces, ZCML-based configuration, adapters, browser pages (including skins, layers, and resources), automated add and edit forms based on schemas, object events, as well as Zope 3-style i18n message catalogs. We've tried to keep the Five experience as close to Zope 3 as possible, so this means that what you learn while using Five should also be applicable to Zope 3, and viceversa. More information about Five can be found on our website, http://codespeak.net/z3/five/. About Five 1.2 and 1.3 ---------------------- Five 1.2 and 1.3 are maintenance releases. They are basically equivalent except that Five 1.2 works with Zope 2.8/X3 3.0 (only) and 1.3 works with Zope 2.9/3.2 (only). Five 1.3 is included in Zope 2.9. This will be the last release of Five 1.2 I will make as the unofficial Five release manager. I don't expect the Zope 2.8 line to live on much longer either. From now on whoever is relying on Five 1.2 will have to make sure they backport and release fixes themselves. Managing more than four stable branches is just too much. About Five 1.4 and 1.5 ---------------------- Five 1.4 and 1.5 are feature releases. They are basically equivalent except that Five 1.4 works with Zope 2.9/3.2 (only) and 1.5 works with Zope 2.10/3.3 (only). Five 1.5 is included in Zope 2.10. Most important features are: * Added viewlet and content provider support. A big thanks to Alec Mitchell and his helpers at the Archipelago sprint for making this possible. * Add zope.formlib support. Please see ``doc/formlib.txt`` for more information. A big thanks to Jan-Wijbrand Kolman for this. * Port zope.testbrowser to Zope 2. You can now use Products.Five.testbrowser.Browser in functional tests. Much thanks to Brian Sutherland. * Add python-packages-as-zope-products support which basically allows for using any python package as a zope product without it having to live in Products/. Much thanks to Rocky Burt for this. Zope 2.10 and Five 1.5 are also a big milestone in the convergence of Zope 2 and Zope 3. Changes in all releases ----------------------- * Allow multiple uses of the / directive. * Fix problem with WebDAV/HEAD requests due to new traversal order. * Backported the new traversal lookup order from Zope 2.10 (attribute, adapter, acquired attribute). Additional changes in Five 1.4.1 -------------------------------- * Made the provider directive acquisition wrap the resultant content provider so that simple providers that need security declarations (e.g. those that render pagetemplates) can work with the Zope 2 security machinery. * Added acquisition wrappers to viewlets before updating or rendering. Additional changes in Five 1.5 ------------------------------ * Moved the custom 'provider:' tales expression back into Five. Made the provider directive acquisition wrap the resultant content provider so that simple providers that need security declarations (e.g. those that render pagetemplates) can work with the Zope 2 security machinery. * Added Five.browser.pagetemplatefile.ViewPageTemplateFile as an alias to ZopeTwoPageTemplateFile and as a Zope 2 correspondence to zope.app.pagetemplate.ViewPageTemplateFile. * Added tests to make sure that views are not blocked by acquired attributes. * Changed the tests to reflect that defaultView no only works for views (and not on attributes). * The FiveSiteManager classes now work again, but are deprecated for the new zope.component support. There is also a method to migrate Five.site to zope.component. About the Zope 3 Base --------------------- Five is part of the *Zope 3 Base* project, which aims to offer an approachable area for developers of Zope 3 related software. More about the Zope 3 base and its projects can be found on the project website, http://codespeak.net/z3/. From richard at iopen.net Thu Aug 17 01:13:19 2006 From: richard at iopen.net (Richard Waid) Date: Thu, 17 Aug 2006 11:13:19 +1200 Subject: [z3-five] Patch to enable recursive resourceDirectory support Message-ID: <1155769999.24847.27.camel@ubuntu> Hi: I noticed that the resourceDirectory directive isn't recursive as it is in Zope3, so I backported the behaviour from Zope3. The patch is attached. Having a lot of fun with Five BTW, makes for a much nicer development experience in Zope2 :) -- Best regards, Richard Waid Network/Software Engineer http://iopen.net -------------- next part -------------- A non-text attachment was scrubbed... Name: resource.diff Type: text/x-patch Size: 4353 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20060817/68f2f516/attachment-0001.bin From philipp at weitershausen.de Thu Aug 17 06:18:37 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 17 Aug 2006 06:18:37 +0200 Subject: [z3-five] Patch to enable recursive resourceDirectory support In-Reply-To: <1155769999.24847.27.camel@ubuntu> References: <1155769999.24847.27.camel@ubuntu> Message-ID: <44E3EE1D.3060500@weitershausen.de> Richard Waid wrote: > I noticed that the resourceDirectory directive isn't recursive as it is > in Zope3, so I backported the behaviour from Zope3. The patch is > attached. Hey, thanks for the patch. Can you also provide a short unit test for this (extending an existing one should be enough)? Then we can include this patch right away. Philipp From richard at iopen.net Thu Aug 17 06:39:16 2006 From: richard at iopen.net (Richard Waid) Date: Thu, 17 Aug 2006 16:39:16 +1200 Subject: [z3-five] Patch to enable recursive resourceDirectory support In-Reply-To: <44E3EE1D.3060500@weitershausen.de> References: <1155769999.24847.27.camel@ubuntu> <44E3EE1D.3060500@weitershausen.de> Message-ID: <1155789556.11292.3.camel@ubuntu> On Thu, 2006-08-17 at 06:18 +0200, Philipp von Weitershausen wrote: > Richard Waid wrote: > > I noticed that the resourceDirectory directive isn't recursive as it is > > in Zope3, so I backported the behaviour from Zope3. The patch is > > attached. > > Hey, thanks for the patch. Can you also provide a short unit test for > this (extending an existing one should be enough)? Then we can include > this patch right away. Sure: """ We also support recursive descent into directorys >>> uri = 'testoid/++resource++fivetest_resources/pages/dirpage1.pt' >>> resource = self.folder.unrestrictedTraverse(uri) >>> isinstance(resource, Resource) True >>> resource.__name__ dirpage1.pt' """ While I'm still on this topic, is there any hope of working around the behaviour of Zope2 which filters out any item in the URI beginning with a '_'. I don't quite get why Zope2 still does that, and Zope3 doesn't, so ... (My motivation for doing the recursive descent was to allow me to dump dojo in as a resource. Which has __package__.js files. Which don't work without me commenting out the appropriate lines in BaseRequest.py ;)) --Richard From philipp at weitershausen.de Mon Aug 21 10:37:22 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Mon, 21 Aug 2006 10:37:22 +0200 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 Message-ID: Hi there, some random notes on Five releases: Five 1.2 -------- I declared last week's 1.2.6 release the last one I would make off of the Five 1.2 branch. I don't expect the Zope 2.8 line to make any more releases either. I realize that Zope 2.8 is in production and might even be used (against my personal recommendation) as the default deployment for e.g. the Plone installers. That's why anyone is welcome to backport bugfixes to Five 1.2 and make releases. I just won't be doing it, and I won't be bugging people to do it either. By the way, I hereby would like to repeat my dismay regarding Plone 2.5's shipping with Five 1.2 by default (if that is still the case). Plone 2.5 should recommend Zope 2.9 (with its included Five 1.3) and should require Five 1.2 for Zope 2.8 compatibility. Five 1.5 -------- Five 1.5 was released last week. That means it is now officially in the maintenance circle (of course, it's been feature-frozen since the first 1.5 beta in May). There currently is no Five 1.5 branch. The trunk is Five 1.5.x. Usually I'm against having the trunk as a release branch but in Five's case I made an exception: till now we've had four parallel, stable branches (1.2, 1.3, 1.4, 1.5) and maintaining yet another one (trunk) would've been an extra burden. As Five 1.2 is now phasing out and we might start development on Five 1.6 (see below), a Five 1.5 branch is to be expected soon. Anyone is welcome to create it in order to lift the current feature freeze on the trunk. Five 1.6 -------- As Five 1.5 is in the maintenance cycle, it's time to start thinking about the next release. Let's hear some proposals for 1.6's features! I think a big one could be Whit Morris's test layer support. And always remember our motto: We accept patches :). Philipp From rocky at serverzen.com Mon Aug 21 16:06:24 2006 From: rocky at serverzen.com (Rocky Burt) Date: Mon, 21 Aug 2006 11:36:24 -0230 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <44CCFE62.4@wcm-solutions.de> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> <44CBA868.9090005@weitershausen.de> <1154210957.27651.1.camel@localhost> <44CCFE62.4@wcm-solutions.de> Message-ID: <1156169178.7229.27.camel@localhost> On Sun, 2006-30-07 at 20:45 +0200, yuppie wrote: > I choose getPhysicalRoot() because I'm not sure how expensive it is to > open a new connection. But Zope2.app() as used in Zope 2.10 works as > well and I can't see a reason for a short-term solution that is different. Sure. I'm not sure how expensive it is either. But regardless, I've now completed the backport from zope 2.10 into Five 1.4 (svn). This is with r69719. I'd mightilly appreciate it if people would report back to me real-world results of this :) Regards, 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060821/70b89a33/attachment.pgp From chris at simplistix.co.uk Mon Aug 21 19:47:39 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 21 Aug 2006 18:47:39 +0100 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <1156169178.7229.27.camel@localhost> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> <44CBA868.9090005@weitershausen.de> <1154210957.27651.1.camel@localhost> <44CCFE62.4@wcm-solutions.de> <1156169178.7229.27.camel@localhost> Message-ID: <44E9F1BB.6090809@simplistix.co.uk> Rocky Burt wrote: > On Sun, 2006-30-07 at 20:45 +0200, yuppie wrote: >> I choose getPhysicalRoot() because I'm not sure how expensive it is to >> open a new connection. But Zope2.app() as used in Zope 2.10 works as >> well and I can't see a reason for a short-term solution that is different. > > Sure. I'm not sure how expensive it is either. But regardless, I've > now completed the backport from zope 2.10 into Five 1.4 (svn). This is > with r69719. I'd mightilly appreciate it if people would report back to > me real-world results of this :) What's the simplest way to test this when I'm working with a Zope 2.9 instance? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From rocky at serverzen.com Mon Aug 21 20:42:15 2006 From: rocky at serverzen.com (Rocky Burt) Date: Mon, 21 Aug 2006 16:12:15 -0230 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <44E9F1BB.6090809@simplistix.co.uk> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> <44CBA868.9090005@weitershausen.de> <1154210957.27651.1.camel@localhost> <44CCFE62.4@wcm-solutions.de> <1156169178.7229.27.camel@localhost> <44E9F1BB.6090809@simplistix.co.uk> Message-ID: <1156185731.7229.36.camel@localhost> On Mon, 2006-21-08 at 18:47 +0100, Chris Withers wrote: > Rocky Burt wrote: > > On Sun, 2006-30-07 at 20:45 +0200, yuppie wrote: > >> I choose getPhysicalRoot() because I'm not sure how expensive it is to > >> open a new connection. But Zope2.app() as used in Zope 2.10 works as > >> well and I can't see a reason for a short-term solution that is different. > > > > Sure. I'm not sure how expensive it is either. But regardless, I've > > now completed the backport from zope 2.10 into Five 1.4 (svn). This is > > with r69719. I'd mightilly appreciate it if people would report back to > > me real-world results of this :) > > What's the simplest way to test this when I'm working with a Zope 2.9 > instance? That's just the problem. It only tends to happen over a long period of time after the server has been up. I didn't have a real way to test the change even though I know how it came about. I know I fixed the problem, what I really need tested is that I didn't introduce more problems :) - 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060821/dc6c3bdc/attachment.pgp From maciej.wisniowski at coig.katowice.pl Tue Aug 22 11:02:51 2006 From: maciej.wisniowski at coig.katowice.pl (=?ISO-8859-2?Q?Maciej_Wi=B6niowski?=) Date: Tue, 22 Aug 2006 11:02:51 +0200 Subject: [z3-five] five:registerClass directive and icon Message-ID: <44EAC83B.2090502@coig.katowice.pl> Hi Is this possible to define a icon for a class (object in ZMI will have icon) without making it also visible in the Add list in ZMI? (Zope2 and Five)?? I have application that consists of few modules. I want every module to be visible as an object in ZMI (usually my module is descendant of Folder that contains e.g. some ZSQLMethods). In the Add list I want to have only Application visible and after adding this the structure of modules will be created in ZODB (vievable by ZMI). I simply want to have icons for module objects created while adding my Application. Is this possible with Five? -- Maciej Wisniowski From regebro at gmail.com Tue Aug 22 11:42:11 2006 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 22 Aug 2006 11:42:11 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <44EAC83B.2090502@coig.katowice.pl> References: <44EAC83B.2090502@coig.katowice.pl> Message-ID: <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> On 8/22/06, Maciej Wi?niowski wrote: > I have application that consists of few modules. > I want every module to be visible as an object in ZMI (usually > my module is descendant of Folder that contains e.g. some > ZSQLMethods). In the Add list I want to have only > Application visible and after adding this the structure > of modules will be created in ZODB (vievable by ZMI). > I simply want to have icons for module objects created > while adding my Application. Is this possible with Five? Of course. All you do is not register as a content class. :-) It's getting the class into the Add menu that takes effort, not the other way around. :-) -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From chris at simplistix.co.uk Tue Aug 22 11:37:09 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 22 Aug 2006 10:37:09 +0100 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <1156185731.7229.36.camel@localhost> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> <44CBA868.9090005@weitershausen.de> <1154210957.27651.1.camel@localhost> <44CCFE62.4@wcm-solutions.de> <1156169178.7229.27.camel@localhost> <44E9F1BB.6090809@simplistix.co.uk> <1156185731.7229.36.camel@localhost> Message-ID: <44EAD045.7030309@simplistix.co.uk> Rocky Burt wrote: > That's just the problem. It only tends to happen over a long period of > time after the server has been up. I didn't have a real way to test the > change even though I know how it came about. I know I fixed the > problem, what I really need tested is that I didn't introduce more > problems :) That's what I meant ;-) I have a Zope 2.9 instance, Twiddler is going to be a lib/python product for Zope 2, so what version of what should I be developing it with? (Five? something else?) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From maciej.wisniowski at coig.katowice.pl Tue Aug 22 12:01:33 2006 From: maciej.wisniowski at coig.katowice.pl (=?ISO-8859-2?Q?Maciej_Wi=B6niowski?=) Date: Tue, 22 Aug 2006 12:01:33 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> Message-ID: <44EAD5FD.8090702@coig.katowice.pl> > Of course. All you do is not register as a content class. :-) > It's getting the class into the Add menu that takes effort, not the > other way around. :-) > You mean that I shouldn't have ' References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> Message-ID: <44EADC33.3000905@wcm-solutions.de> Hi Maciej! Maciej Wi?niowski wrote: > If you mean that I shouldn't use five:registerClass then how > should I define specific icon for my class? That was the > question :) The ZMI looks for an 'icon' attribute. If you just need the icon you can add an 'icon' attribute to your class. But copy, move or export/re-import of your objects will not work without using five:registerClass. Using a recent Zope version you can omit the 'addview' attribute if you don't want to show the type in the 'Add' list. HTH, Yuppie From maciej.wisniowski at coig.katowice.pl Tue Aug 22 13:46:16 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Tue, 22 Aug 2006 13:46:16 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <44EADC33.3000905@wcm-solutions.de> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> Message-ID: <44EAEE88.4090705@coig.katowice.pl> > The ZMI looks for an 'icon' attribute. If you just need the icon you > can add an 'icon' attribute to your class. Seems that meta_type is necessary too (at last to see what kind of object is this in ZMI). I know about that I can set this as an attribute but I was wondering about Five version :) > But copy, move or export/re-import of your objects will not work > without using five:registerClass. Good to know. > Using a recent Zope version you can omit the 'addview' attribute if > you don't want to show the type in the 'Add' list. I'm not using addview there so it would be the best solution. What do you mean by recent Zope version? 2.10? or maybe Five1.5 is enough? I'm using Zope 2.9.4 and Five 1.4 right now. -- Maciej Wisniowski From rocky at serverzen.com Tue Aug 22 13:54:25 2006 From: rocky at serverzen.com (Rocky Burt) Date: Tue, 22 Aug 2006 09:24:25 -0230 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <44EAD045.7030309@simplistix.co.uk> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> <44CBA868.9090005@weitershausen.de> <1154210957.27651.1.camel@localhost> <44CCFE62.4@wcm-solutions.de> <1156169178.7229.27.camel@localhost> <44E9F1BB.6090809@simplistix.co.uk> <1156185731.7229.36.camel@localhost> <44EAD045.7030309@simplistix.co.uk> Message-ID: <1156247658.6601.8.camel@localhost> On Tue, 2006-22-08 at 10:37 +0100, Chris Withers wrote: > I have a Zope 2.9 instance, Twiddler is going to be a lib/python product > for Zope 2, so what version of what should I be developing it with? > (Five? something else?) If you need CMF support, you will still need my separate pythonproducts product. http://plone.org/products/pythonproducts If you do not need CMF support, using either Zope 2.9 + Five 1.4 *or* simply Zope 2.10 will suffice. If you decide you can run this on Zope 2.9 + Five 1.4 without pythonproducts, you'll need to see Five/skel/README.txt if you need to activate a ZCML slug. Regards, 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060822/ea3026e8/attachment.pgp From regebro at gmail.com Tue Aug 22 14:23:34 2006 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 22 Aug 2006 14:23:34 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <44EAEE88.4090705@coig.katowice.pl> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> <44EAEE88.4090705@coig.katowice.pl> Message-ID: <319e029f0608220523j1a9a1139n1fe88417f15111dd@mail.gmail.com> On 8/22/06, Maciej Wisniowski wrote: > > > The ZMI looks for an 'icon' attribute. If you just need the icon you > > can add an 'icon' attribute to your class. > > Seems that meta_type is necessary too (at last to see what kind of > object is this in ZMI). I'm getting very confused now, it seems to me that you are sometimes talking about the class, and sometimes about the classes icon, and you call both of them "this". Could you explain what you are trying to do, and what the problem is? -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From maciej.wisniowski at coig.katowice.pl Tue Aug 22 15:06:46 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Tue, 22 Aug 2006 15:06:46 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <319e029f0608220523j1a9a1139n1fe88417f15111dd@mail.gmail.com> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> <44EAEE88.4090705@coig.katowice.pl> <319e029f0608220523j1a9a1139n1fe88417f15111dd@mail.gmail.com> Message-ID: <44EB0166.7070807@coig.katowice.pl> > I'm getting very confused now, it seems to me that you are sometimes > talking about the class, and sometimes about the classes icon, and you > call both of them "this". Uhm.. sorry about that. > > Could you explain what you are trying to do, and what the problem is? > Say I have 'Application' that consists of 'modules'. 'Application' is general class defined in Products/MyApp and 'modules' are classes defined in folders like Products/Module1 etc. I don't want anybody to be able to add my 'modules' in ZMI with 'Add list'. 'Modules' are created by 'Application' product while adding it in ZMI. So after adding my 'Application' via ZMI (from 'Add list') I want to see structure like: my_application(MyApp)/ /module1 (Module1) /SQL (something...) /... /module2 (Module2) /SQL /... And I want to have diferent icons for my 'modules'. Problem is that when I use five:registerClass I have nice icons for my objects (modules) but they (modules) are also visible in 'Add list'. Without registerClass I have no my 'modules' in 'Add list' but I also have no icons for them while viewing with ZMI. Hope I made it clearer... :) -- Maciej Wisniowski From y.2006_ at wcm-solutions.de Tue Aug 22 15:13:08 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Tue, 22 Aug 2006 15:13:08 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <44EAEE88.4090705@coig.katowice.pl> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> <44EAEE88.4090705@coig.katowice.pl> Message-ID: <44EB02E4.90806@wcm-solutions.de> Maciej Wisniowski wrote: >> Using a recent Zope version you can omit the 'addview' attribute if >> you don't want to show the type in the 'Add' list. > > I'm not using addview there so it would be the best solution. What do > you mean by recent Zope version? > 2.10? or maybe Five1.5 is enough? I'm using Zope 2.9.4 and Five 1.4 > right now. Changed that 8 months ago. Zope 2.8.5 or later should work. The necessary changes are in Zope, not in Five. Zope 2.9.4 is fine. But you might have trouble if you use ExternalEditor, AFAIK it was never updated. Cheers, Yuppie From maciej.wisniowski at coig.katowice.pl Tue Aug 22 15:25:22 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Tue, 22 Aug 2006 15:25:22 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <44EB02E4.90806@wcm-solutions.de> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> <44EAEE88.4090705@coig.katowice.pl> <44EB02E4.90806@wcm-solutions.de> Message-ID: <44EB05C2.5060505@coig.katowice.pl> > But you might have trouble if you use ExternalEditor, AFAIK it was > never updated. Indeed! Without ExternalEditor it works correctly. Thanks. Unfortunatelly I need ExternalEditor... hmm... Any clues what should be changed in ExternalEditor? -- Maciej Wisniowski From y.2006_ at wcm-solutions.de Tue Aug 22 15:33:58 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Tue, 22 Aug 2006 15:33:58 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <44EB05C2.5060505@coig.katowice.pl> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> <44EAEE88.4090705@coig.katowice.pl> <44EB02E4.90806@wcm-solutions.de> <44EB05C2.5060505@coig.katowice.pl> Message-ID: <44EB07C6.1010603@wcm-solutions.de> Maciej Wisniowski wrote: >> But you might have trouble if you use ExternalEditor, AFAIK it was >> never updated. > > Indeed! Without ExternalEditor it works correctly. Thanks. > > Unfortunatelly I need ExternalEditor... hmm... Any clues what should be > changed > in ExternalEditor? ExternalEditor monkey patches manage_main. The changes in OFS/dtml/main.dtml have to be ported to the version shipped with ExternalEditor. Cheers, Yuppie From regebro at gmail.com Tue Aug 22 17:05:56 2006 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 22 Aug 2006 17:05:56 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <44EB0166.7070807@coig.katowice.pl> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> <44EAEE88.4090705@coig.katowice.pl> <319e029f0608220523j1a9a1139n1fe88417f15111dd@mail.gmail.com> <44EB0166.7070807@coig.katowice.pl> Message-ID: <319e029f0608220805r6bfba7fhf88c3cff871ba55a@mail.gmail.com> On 8/22/06, Maciej Wisniowski wrote: > Say I have 'Application' that consists of 'modules'. 'Application' is > general class defined in Products/MyApp > and 'modules' are classes defined in folders like Products/Module1 etc. OK. > I don't want anybody to be able to add my 'modules' in ZMI with 'Add list'. > 'Modules' are created by 'Application' product while adding > it in ZMI. So after adding my 'Application' via ZMI (from 'Add list') > I want to see structure like: > > my_application(MyApp)/ > /module1 (Module1) > /SQL (something...) > /... > /module2 (Module2) > /SQL > /... > > And I want to have diferent icons for my 'modules'. > > Problem is that when I use five:registerClass I have nice icons for > my objects (modules) but they (modules) are also visible in > 'Add list'. Without registerClass I have no my 'modules' in 'Add list' > but I also have no icons for them while viewing with ZMI. Ah, OK, then I get it, and have nothing to add to yuppies answers. :) -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From y.2006_ at wcm-solutions.de Tue Aug 22 21:48:12 2006 From: y.2006_ at wcm-solutions.de (yuppie) Date: Tue, 22 Aug 2006 21:48:12 +0200 Subject: [z3-five] ConnectionStateError: Shouldn't load state for 0x04 when the connection is closed In-Reply-To: <1156169178.7229.27.camel@localhost> References: <44C8C8A9.9030901@nidelven-it.no> <44C8E965.2000809@wcm-solutions.de> <44CBA868.9090005@weitershausen.de> <1154210957.27651.1.camel@localhost> <44CCFE62.4@wcm-solutions.de> <1156169178.7229.27.camel@localhost> Message-ID: <44EB5F7C.1030307@wcm-solutions.de> Rocky Burt wrote: > On Sun, 2006-30-07 at 20:45 +0200, yuppie wrote: >> I choose getPhysicalRoot() because I'm not sure how expensive it is to >> open a new connection. But Zope2.app() as used in Zope 2.10 works as >> well and I can't see a reason for a short-term solution that is different. > > Sure. I'm not sure how expensive it is either. But regardless, I've > now completed the backport from zope 2.10 into Five 1.4 (svn). This is > with r69719. I'd mightilly appreciate it if people would report back to > me real-world results of this :) Great! Today I updated my real-world server. Works fine so far, I'll let you know if I see any issues. Cheers, Yuppie From maciej.wisniowski at coig.katowice.pl Wed Aug 23 08:09:18 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Wed, 23 Aug 2006 08:09:18 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <44EB07C6.1010603@wcm-solutions.de> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> <44EAEE88.4090705@coig.katowice.pl> <44EB02E4.90806@wcm-solutions.de> <44EB05C2.5060505@coig.katowice.pl> <44EB07C6.1010603@wcm-solutions.de> Message-ID: <44EBF10E.5090804@coig.katowice.pl> > ExternalEditor monkey patches manage_main. The changes > in OFS/dtml/main.dtml have to be ported to the version > shipped with ExternalEditor. I changed this and now everyting works correctly :) Thank you! -- Maciej Wisniowski From r.ritz at biologie.hu-berlin.de Wed Aug 23 09:44:20 2006 From: r.ritz at biologie.hu-berlin.de (Raphael Ritz) Date: Wed, 23 Aug 2006 09:44:20 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: <44EBF10E.5090804@coig.katowice.pl> References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> <44EAEE88.4090705@coig.katowice.pl> <44EB02E4.90806@wcm-solutions.de> <44EB05C2.5060505@coig.katowice.pl> <44EB07C6.1010603@wcm-solutions.de> <44EBF10E.5090804@coig.katowice.pl> Message-ID: Maciej Wisniowski schrieb: > > ExternalEditor monkey patches manage_main. The changes > > in OFS/dtml/main.dtml have to be ported to the version > > shipped with ExternalEditor. > I changed this and now everyting works > correctly :) Thank you! > Any chance this patch could land in ExternalEditor proper? Raphael From maciej.wisniowski at coig.katowice.pl Wed Aug 23 10:16:33 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Wed, 23 Aug 2006 10:16:33 +0200 Subject: [z3-five] five:registerClass directive and icon In-Reply-To: References: <44EAC83B.2090502@coig.katowice.pl> <319e029f0608220242h7086ea0dlc7b35c20d2d470a4@mail.gmail.com> <44EAD5FD.8090702@coig.katowice.pl> <44EADC33.3000905@wcm-solutions.de> <44EAEE88.4090705@coig.katowice.pl> <44EB02E4.90806@wcm-solutions.de> <44EB05C2.5060505@coig.katowice.pl> <44EB07C6.1010603@wcm-solutions.de> <44EBF10E.5090804@coig.katowice.pl> Message-ID: <44EC0EE1.4070205@coig.katowice.pl> >Any chance this patch could land in ExternalEditor proper? > > I've submitted an issue on plope.org: http://plope.com/software/collector/185 -- Maciej Wisniowski From anton at headnet.dk Wed Aug 23 11:50:52 2006 From: anton at headnet.dk (Anton Stonor) Date: Wed, 23 Aug 2006 11:50:52 +0200 Subject: [z3-five] Using templates for content providers Message-ID: How do I use a page template to render a content provider on Zope 2.9.3/Five 1.4? My dummy content provider works (see below). Now I want to use a page template to render the HTML fragment. However, doing this .... render = ZopeTwoPageTemplateFile('fragment.pt') .... gives an error: 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 Products.five_hello_rdb.rdbview, line 41, in __call__ Module Shared.DC.Scripts.Bindings, line 312, in __call__ Module Shared.DC.Scripts.Bindings, line 347, in _bindAndExec Module Shared.DC.Scripts.Bindings, line 1, in ? Module Shared.DC.Scripts.Bindings, line 292, in _getTraverseSubpath AttributeError: 'str' object has no attribute 'other' It seems like the REQUEST attribute on the ZopeTwoPageTemplateFile instance is a string-like ('') where _getTraverseSubpath expects a request object. Any ideas? Another, related issue: Is it possible in ZCML to configure a page template to be used for a content provider - like for normal views? class StupidProfider(object): zope.interface.implements(interfaces.IContentProvider) zope.component.adapts(zope.interface.Interface, browser.IDefaultBrowserLayer, zope.interface.Interface) def __init__(self, context, request, view): self.__parent__ = view self.request = request self.context = context def update(self): pass def render(self): return "hello world" /Anton From anton at headnet.dk Wed Aug 23 14:10:17 2006 From: anton at headnet.dk (Anton Stonor) Date: Wed, 23 Aug 2006 14:10:17 +0200 Subject: [z3-five] Using templates for content providers In-Reply-To: References: Message-ID: I wrote: > How do I use a page template to render a content provider on Zope > 2.9.3/Five 1.4? > > My dummy content provider works (see below). > > Now I want to use a page template to render the HTML fragment. > > However, doing this .... > > render = ZopeTwoPageTemplateFile('fragment.pt') OK, digging deeper: It looks like I need to wrap the template in acquisition: ZopeTwoPageTemplateFile('fragment.pt').__of__(self.context) That works. This issue remains: > Another, related issue: Is it possible in ZCML to configure a page > template to be used for a content provider - like for normal views? /Anton From sebastien.vinot at logisphere.fr Wed Aug 23 14:25:20 2006 From: sebastien.vinot at logisphere.fr (=?ISO-8859-1?Q?S=E9bastien_VINOT?=) Date: Wed, 23 Aug 2006 14:25:20 +0200 Subject: [z3-five] Configuration error Message-ID: <44EC4930.9090506@logisphere.fr> Hello, I'm trying to use Five (1.3.6) with Zope 2.9.4 and I get this error : ConfigurationError: ('Unknown directive', u'http://namespaces.zope.org/five', u'subscriber') My configuration file has this next line : I have to say "evtCreated" is a very simple function (just for test) def evtCreated(document, event): """ Reponse a l'evenement : 'Creation d'un objet sqlBackup'. """ mailhost = getToolByName(document, 'MailHost') msg = "Document cree" mto = 'sebastien.vinot at logisphere.fr' mfrom = 'webmaster at logiTest.com' msubject = 'Document cree !!!' mailhost.send(msg, mto, mfrom, msubject=msubject) Does that mean Fiver don't konw 'subscriber' ? Sebastien From rocky at serverzen.com Wed Aug 23 14:35:22 2006 From: rocky at serverzen.com (Rocky Burt) Date: Wed, 23 Aug 2006 10:05:22 -0230 Subject: [z3-five] Configuration error In-Reply-To: <44EC4930.9090506@logisphere.fr> References: <44EC4930.9090506@logisphere.fr> Message-ID: <1156336519.8279.35.camel@localhost> On Wed, 2006-23-08 at 14:25 +0200, S?bastien VINOT wrote: > Hello, > > I'm trying to use Five (1.3.6) with Zope 2.9.4 and I get this error : > > ConfigurationError: ('Unknown directive', > u'http://namespaces.zope.org/five', u'subscriber') > > My configuration file has this next line : > > for="Products.logiTest.interfaces.sqlBackup.ISqlBackup > zope.app.container.interfaces.IObjectAddedEvent" > handler="Products.logiTest.events.evtSqlBackup.evtCreated" /> > > I have to say "evtCreated" is a very simple function (just for test) > > def evtCreated(document, event): > """ > Reponse a l'evenement : 'Creation d'un objet sqlBackup'. > """ > mailhost = getToolByName(document, 'MailHost') > msg = "Document cree" > mto = 'sebastien.vinot at logisphere.fr' > mfrom = 'webmaster at logiTest.com' > msubject = 'Document cree !!!' > mailhost.send(msg, mto, mfrom, msubject=msubject) > > Does that mean Fiver don't konw 'subscriber' ? You have apparently setup configure.zcml to use a default namespace that points to Five. Make sure you have a namespace declaration attribute on your toplevel tag like this: xmlns:zope="http://namespaces.zope.org/zope" Then, where you specify References: <44EC4930.9090506@logisphere.fr> <1156336519.8279.35.camel@localhost> Message-ID: <44EC4FFE.7060700@logisphere.fr> Rocky Burt a ?crit : > On Wed, 2006-23-08 at 14:25 +0200, S?bastien VINOT wrote: > >> Hello, >> >> I'm trying to use Five (1.3.6) with Zope 2.9.4 and I get this error : >> >> ConfigurationError: ('Unknown directive', >> u'http://namespaces.zope.org/five', u'subscriber') >> >> My configuration file has this next line : >> >> > for="Products.logiTest.interfaces.sqlBackup.ISqlBackup >> zope.app.container.interfaces.IObjectAddedEvent" >> handler="Products.logiTest.events.evtSqlBackup.evtCreated" /> >> >> I have to say "evtCreated" is a very simple function (just for test) >> >> def evtCreated(document, event): >> """ >> Reponse a l'evenement : 'Creation d'un objet sqlBackup'. >> """ >> mailhost = getToolByName(document, 'MailHost') >> msg = "Document cree" >> mto = 'sebastien.vinot at logisphere.fr' >> mfrom = 'webmaster at logiTest.com' >> msubject = 'Document cree !!!' >> mailhost.send(msg, mto, mfrom, msubject=msubject) >> >> Does that mean Fiver don't konw 'subscriber' ? >> > > You have apparently setup configure.zcml to use a default namespace that > points to Five. Make sure you have a namespace declaration attribute on > your toplevel tag like this: > xmlns:zope="http://namespaces.zope.org/zope" > > Then, where you specify > Hope that helps. > > - Rocky > > > ------------------------------------------------------------------------ > > _______________________________________________ > z3-five mailing list > z3-five at codespeak.net > http://codespeak.net/mailman/listinfo/z3-five > Yes it works now. Thanks for your help. Sebastien From sebastien.vinot at logisphere.fr Thu Aug 24 18:19:12 2006 From: sebastien.vinot at logisphere.fr (=?ISO-8859-1?Q?S=E9bastien_VINOT?=) Date: Thu, 24 Aug 2006 18:19:12 +0200 Subject: [z3-five] Defining default view with Plone Message-ID: <44EDD180.7010704@logisphere.fr> Hello, I'd like to definie a new view for my interface which has to correspond to the default view of my object. I did this on my ZCML file : If I do "http....myObj/View" I get my customized view. But, "http .... myObj" gives me the default Plone View : How can I change it ? Sebastien From rocky at serverzen.com Thu Aug 24 18:24:23 2006 From: rocky at serverzen.com (Rocky Burt) Date: Thu, 24 Aug 2006 13:54:23 -0230 Subject: [z3-five] Defining default view with Plone In-Reply-To: <44EDD180.7010704@logisphere.fr> References: <44EDD180.7010704@logisphere.fr> Message-ID: <1156436658.8279.91.camel@localhost> On Thu, 2006-24-08 at 18:19 +0200, S?bastien VINOT wrote: > Hello, > > I'd like to definie a new view for my interface which has to correspond > to the default view of my object. > > I did this on my ZCML file : > > for="Products.test.interfaces.sqlBackup.ISqlBackup" > name="View" > template="skins/test/sqlBackup.pt" > permission="zope2.View" /> > > If I do "http....myObj/View" I get my customized view. But, "http .... > myObj" gives me the default Plone View : How can I change it ? Hi S?bastien, This isn't really a Five issue... more of a CMF/Archetypes issue. In any event, with an Archetypes based content type you normally override default_view, immediate_view, and the 'view' action to point to whatever the default view should be (in this case, /View). CMF/AT will take care of the rest (make sure you reinstall the product via quickinstaller after you change this). - 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060824/e64b4fe3/attachment.pgp From sebastien.vinot at logisphere.fr Thu Aug 24 20:49:09 2006 From: sebastien.vinot at logisphere.fr (=?UTF-8?B?U8OpYmFzdGllbiBWSU5PVA==?=) Date: Thu, 24 Aug 2006 20:49:09 +0200 Subject: [z3-five] Defining default view with Plone In-Reply-To: <1156436658.8279.91.camel@localhost> References: <44EDD180.7010704@logisphere.fr> <1156436658.8279.91.camel@localhost> Message-ID: <44EDF4A5.70902@logisphere.fr> Rocky Burt a ?crit : > On Thu, 2006-24-08 at 18:19 +0200, S?bastien VINOT wrote: > >> Hello, >> >> I'd like to definie a new view for my interface which has to correspond >> to the default view of my object. >> >> I did this on my ZCML file : >> >> > for="Products.test.interfaces.sqlBackup.ISqlBackup" >> name="View" >> template="skins/test/sqlBackup.pt" >> permission="zope2.View" /> >> >> If I do "http....myObj/View" I get my customized view. But, "http .... >> myObj" gives me the default Plone View : How can I change it ? >> > > > Hi S?bastien, > > This isn't really a Five issue... more of a CMF/Archetypes issue. In > any event, with an Archetypes based content type you normally override > default_view, immediate_view, and the 'view' action to point to whatever > the default view should be (in this case, /View). CMF/AT will take care > of the rest (make sure you reinstall the product via quickinstaller > after you change this). > > - Rocky > Well, I thought it was possible to describe it using the ZCML file : that was an error Thanks for the information Sebastien From k_vertigo at objectrealms.net Sat Aug 26 04:48:54 2006 From: k_vertigo at objectrealms.net (Kapil Thangavelu) Date: Fri, 25 Aug 2006 22:48:54 -0400 Subject: [z3-five] Defining default view with Plone In-Reply-To: <44EDF4A5.70902@logisphere.fr> References: <44EDD180.7010704@logisphere.fr> <1156436658.8279.91.camel@localhost> <44EDF4A5.70902@logisphere.fr> Message-ID: for non at types, and perhaps at as well from zcml you also need to configure the default view in addition to the view definition. ie. -k On Thu, 24 Aug 2006 14:49:09 -0400, S?bastien VINOT wrote: > Rocky Burt a ?crit : >> On Thu, 2006-24-08 at 18:19 +0200, S?bastien VINOT wrote: >> >>> Hello, >>> >>> I'd like to definie a new view for my interface which has to correspond >>> to the default view of my object. >>> >>> I did this on my ZCML file : >>> >>> >> for="Products.test.interfaces.sqlBackup.ISqlBackup" >>> name="View" >>> template="skins/test/sqlBackup.pt" >>> permission="zope2.View" /> >>> >>> If I do "http....myObj/View" I get my customized view. But, "http .... >>> myObj" gives me the default Plone View : How can I change it ? >>> >> >> >> Hi S?bastien, >> >> This isn't really a Five issue... more of a CMF/Archetypes issue. In >> any event, with an Archetypes based content type you normally override >> default_view, immediate_view, and the 'view' action to point to whatever >> the default view should be (in this case, /View). CMF/AT will take care >> of the rest (make sure you reinstall the product via quickinstaller >> after you change this). >> >> - Rocky >> From philipp at weitershausen.de Tue Aug 29 22:18:25 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 29 Aug 2006 22:18:25 +0200 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: References: Message-ID: Philipp von Weitershausen wrote: > Five 1.6 > -------- > > As Five 1.5 is in the maintenance cycle, it's time to start thinking > about the next release. Let's hear some proposals for 1.6's features! I > think a big one could be Whit Morris's test layer support. I think another one should be decent local site machinery. A lot of stuff is possible with bare zope.component (e.g. using the PersistentRegistry). That won't give you all the features you'd expect from knowing Zope3, for example the cascaded component lookup to sites higher up in the hierarchy. Essentially, we'd need a Five reinterpretation of Zope 3's LocalSiteManager... Philipp From rocky at serverzen.com Tue Aug 29 23:25:15 2006 From: rocky at serverzen.com (Rocky Burt) Date: Tue, 29 Aug 2006 18:55:15 -0230 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: References: Message-ID: <1156886713.21151.58.camel@localhost> On Tue, 2006-29-08 at 22:18 +0200, Philipp von Weitershausen wrote: > Philipp von Weitershausen wrote: > > Five 1.6 > > -------- > > > > As Five 1.5 is in the maintenance cycle, it's time to start thinking > > about the next release. Let's hear some proposals for 1.6's features! I > > think a big one could be Whit Morris's test layer support. > > I think another one should be decent local site machinery. A lot of > stuff is possible with bare zope.component (e.g. using the > PersistentRegistry). That won't give you all the features you'd expect > from knowing Zope3, for example the cascaded component lookup to sites > higher up in the hierarchy. Essentially, we'd need a Five > reinterpretation of Zope 3's LocalSiteManager... Woot, +10 on this from me. - 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: 191 bytes Desc: This is a digitally signed message part Url : http://codespeak.net/pipermail/z3-five/attachments/20060829/a4f1d37c/attachment.pgp From richard at iopen.net Tue Aug 29 23:32:32 2006 From: richard at iopen.net (Richard Waid) Date: Wed, 30 Aug 2006 09:32:32 +1200 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: <1156886713.21151.58.camel@localhost> References: <1156886713.21151.58.camel@localhost> Message-ID: <1156887152.6173.5.camel@ubuntu> On Tue, 2006-08-29 at 18:55 -0230, Rocky Burt wrote: > On Tue, 2006-29-08 at 22:18 +0200, Philipp von Weitershausen wrote: > > Philipp von Weitershausen wrote: > > > Five 1.6 > > > -------- > > > > > > As Five 1.5 is in the maintenance cycle, it's time to start thinking > > > about the next release. Let's hear some proposals for 1.6's features! I > > > think a big one could be Whit Morris's test layer support. How about an audit of the existing Five features in an attempt to make them work as much like current-Zope3 as possible (including minimising the code). I've discovered after implementing my first major component in Five that it's the _little_ things that trap you, not the big things (the non-recursive resourceDirectory directive for example). The big things you know you can't use because they're not implemented at all :) --Richard From philipp at weitershausen.de Wed Aug 30 07:37:55 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 30 Aug 2006 07:37:55 +0200 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: <1156886713.21151.58.camel@localhost> References: <1156886713.21151.58.camel@localhost> Message-ID: <44F52433.3080205@weitershausen.de> Rocky Burt wrote: > On Tue, 2006-29-08 at 22:18 +0200, Philipp von Weitershausen wrote: >> Philipp von Weitershausen wrote: >>> Five 1.6 >>> -------- >>> >>> As Five 1.5 is in the maintenance cycle, it's time to start thinking >>> about the next release. Let's hear some proposals for 1.6's features! I >>> think a big one could be Whit Morris's test layer support. >> I think another one should be decent local site machinery. A lot of >> stuff is possible with bare zope.component (e.g. using the >> PersistentRegistry). That won't give you all the features you'd expect >> from knowing Zope3, for example the cascaded component lookup to sites >> higher up in the hierarchy. Essentially, we'd need a Five >> reinterpretation of Zope 3's LocalSiteManager... > > Woot, +10 on this from me. Do I take it you're volunteering for this? ;) (sorry for the re-send, wasn't including list before) From philipp at weitershausen.de Wed Aug 30 07:39:11 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 30 Aug 2006 07:39:11 +0200 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: <1156887152.6173.5.camel@ubuntu> References: <1156886713.21151.58.camel@localhost> <1156887152.6173.5.camel@ubuntu> Message-ID: <44F5247F.8050508@weitershausen.de> Richard Waid wrote: > On Tue, 2006-08-29 at 18:55 -0230, Rocky Burt wrote: >> On Tue, 2006-29-08 at 22:18 +0200, Philipp von Weitershausen wrote: >>> Philipp von Weitershausen wrote: >>>> Five 1.6 >>>> -------- >>>> >>>> As Five 1.5 is in the maintenance cycle, it's time to start thinking >>>> about the next release. Let's hear some proposals for 1.6's features! I >>>> think a big one could be Whit Morris's test layer support. > > How about an audit of the existing Five features in an attempt to make > them work as much like current-Zope3 as possible (including minimising > the code). That sounds like a very good idea. I've been doing such things on a minimal scale in the past as time allowed. Feel free to send patches :). Philipp From philipp at weitershausen.de Wed Aug 30 07:44:09 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 30 Aug 2006 07:44:09 +0200 Subject: [z3-five] Using templates for content providers In-Reply-To: References: Message-ID: <44F525A9.3080108@weitershausen.de> Anton Stonor wrote: > I wrote: > >> How do I use a page template to render a content provider on Zope >> 2.9.3/Five 1.4? >> >> My dummy content provider works (see below). >> >> Now I want to use a page template to render the HTML fragment. >> >> However, doing this .... >> >> render = ZopeTwoPageTemplateFile('fragment.pt') > > OK, digging deeper: It looks like I need to wrap the template in > acquisition: ZopeTwoPageTemplateFile('fragment.pt').__of__(self.context) > > That works. > > This issue remains: > >> Another, related issue: Is it possible in ZCML to configure a page >> template to be used for a content provider - like for normal views? Well, you can either refer to the template in the class via ZopeTwoPageTemplateFile (which has an called ViewPageTemplateFile in recent Five versions, I think that reads better and it has the same name as its Zope 3 equivalent), like you do above. You could also do it all in ZCML by registering a viewlet with class="..." and template="..." Philipp From anton at headnet.dk Wed Aug 30 08:00:35 2006 From: anton at headnet.dk (Anton Stonor) Date: Wed, 30 Aug 2006 08:00:35 +0200 Subject: [z3-five] Using templates for content providers In-Reply-To: <44F525A9.3080108@weitershausen.de> References: <44F525A9.3080108@weitershausen.de> Message-ID: Philipp von Weitershausen wrote: >>> Another, related issue: Is it possible in ZCML to configure a page >>> template to be used for a content provider - like for normal views? > > Well, you can either refer to the template in the class via > ZopeTwoPageTemplateFile (which has an called ViewPageTemplateFile in > recent Five versions, I think that reads better and it has the same name > as its Zope 3 equivalent), like you do above. Right, good point to use the alias. > You could also do it all in ZCML by registering a viewlet with > class="..." and template="..." I ended up taking that path even though you need viewlet managers. Actually I don't really understand why we need two different concepts (content providers and viewlets) that are so similar. Why not just deal with viewlets that can be registered with a viewlet manager or stand alone? Anyway, that's another discussion. Thanks, Anton From philipp at weitershausen.de Wed Aug 30 08:27:17 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 30 Aug 2006 08:27:17 +0200 Subject: [z3-five] Using templates for content providers In-Reply-To: References: <44F525A9.3080108@weitershausen.de> Message-ID: <44F52FC5.8000102@weitershausen.de> Anton Stonor wrote: > Philipp von Weitershausen wrote: > >>>> Another, related issue: Is it possible in ZCML to configure a page >>>> template to be used for a content provider - like for normal views? >> Well, you can either refer to the template in the class via >> ZopeTwoPageTemplateFile (which has an called ViewPageTemplateFile in >> recent Five versions, I think that reads better and it has the same name >> as its Zope 3 equivalent), like you do above. > > Right, good point to use the alias. > >> You could also do it all in ZCML by registering a viewlet with >> class="..." and template="..." > > I ended up taking that path even though you need viewlet managers. > > Actually I don't really understand why we need two different concepts > (content providers and viewlets) that are so similar. Why not just deal > with viewlets that can be registered with a viewlet manager or stand > alone? Anyway, that's another discussion. I'll tell you in Copenhagen :) In short: viewlet managers are content providers that are composed of many more content providers called viewlets. From richard at iopen.net Wed Aug 30 09:34:28 2006 From: richard at iopen.net (Richard Waid) Date: Wed, 30 Aug 2006 19:34:28 +1200 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: <44F5247F.8050508@weitershausen.de> References: <1156886713.21151.58.camel@localhost> <1156887152.6173.5.camel@ubuntu> <44F5247F.8050508@weitershausen.de> Message-ID: <1156923268.5586.8.camel@richard-laptop> On Wed, 2006-08-30 at 07:39 +0200, Philipp von Weitershausen wrote: > Richard Waid wrote: > > How about an audit of the existing Five features in an attempt to make > > them work as much like current-Zope3 as possible (including minimising > > the code). > > That sounds like a very good idea. I've been doing such things on a > minimal scale in the past as time allowed. Feel free to send patches :). I'm more than keen to chip in here ... but I'd really need to have a bit of hand holding, my knowledge of Five and Zope 3 isn't exactly top notch yet :) I guess starting with what features/directives are actually somewhat implemented and figuring out what they do compared with Zope 3 would be a good start! --Richard From philipp at weitershausen.de Wed Aug 30 09:42:22 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 30 Aug 2006 09:42:22 +0200 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: <1156923268.5586.8.camel@richard-laptop> References: <1156886713.21151.58.camel@localhost> <1156887152.6173.5.camel@ubuntu> <44F5247F.8050508@weitershausen.de> <1156923268.5586.8.camel@richard-laptop> Message-ID: <44F5415E.7040301@weitershausen.de> Richard Waid wrote: > On Wed, 2006-08-30 at 07:39 +0200, Philipp von Weitershausen wrote: >> Richard Waid wrote: >>> How about an audit of the existing Five features in an attempt to make >>> them work as much like current-Zope3 as possible (including minimising >>> the code). >> That sounds like a very good idea. I've been doing such things on a >> minimal scale in the past as time allowed. Feel free to send patches :). > > I'm more than keen to chip in here ... but I'd really need to have a bit > of hand holding, my knowledge of Five and Zope 3 isn't exactly top notch > yet :) > > I guess starting with what features/directives are actually somewhat > implemented and figuring out what they do compared with Zope 3 would be > a good start! Yup. Note that last time I looked at the browser page/view stuff, most of the code duplication in there was actually needed :(, due to the necessity of Acquisition. This will only disappear when we introduce __parent__ pointers as an alternative to Acquisition (of which I have a prototype working with segfaults ;)). But, as you pointed out earlier, some of the code in browser resources might be reduced. Philipp From regebro at gmail.com Wed Aug 30 12:43:13 2006 From: regebro at gmail.com (Lennart Regebro) Date: Wed, 30 Aug 2006 12:43:13 +0200 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: <44F5415E.7040301@weitershausen.de> References: <1156886713.21151.58.camel@localhost> <1156887152.6173.5.camel@ubuntu> <44F5247F.8050508@weitershausen.de> <1156923268.5586.8.camel@richard-laptop> <44F5415E.7040301@weitershausen.de> Message-ID: <319e029f0608300343u4c7f672fg647e1a38a933cfac@mail.gmail.com> Hmm. Sounds to me like it's time to make yet another attempt at porting CalZope to Zope3, and see what incompatibilities I run into. ;) I'll get going on that after 2.10 is released, I guess. From fafhrd at datacom.kz Thu Aug 31 08:15:51 2006 From: fafhrd at datacom.kz (Nikolay Kim) Date: Thu, 31 Aug 2006 12:15:51 +0600 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: References: Message-ID: <1157004951.3967.10.camel@localhost.localdomain> Hi, > And always remember our motto: We accept patches :). here patch that allow use browser:icon to define icon for zmi it works with Five-1.4 but i don't see any problems with other versions -------------- next part -------------- A non-text attachment was scrubbed... Name: icon.diff Type: text/x-patch Size: 9967 bytes Desc: not available Url : http://codespeak.net/pipermail/z3-five/attachments/20060831/af578ab1/attachment-0001.bin From fafhrd at datacom.kz Fri Sep 1 09:57:33 2006 From: fafhrd at datacom.kz (Nikolay Kim) Date: Fri, 01 Sep 2006 13:57:33 +0600 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: <1157004951.3967.10.camel@localhost.localdomain> References: <1157004951.3967.10.camel@localhost.localdomain> Message-ID: <1157097453.4070.2.camel@localhost.localdomain> > > And always remember our motto: We accept patches :). > > here patch that allow use browser:icon to define icon for zmi > it works with Five-1.4 but i don't see any problems with other versions seems Five doesn't need this patch.. From philipp at weitershausen.de Fri Sep 1 10:34:55 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Fri, 01 Sep 2006 10:34:55 +0200 Subject: [z3-five] Five release management: 1.2, 1.5 und 1.6 In-Reply-To: <1157097453.4070.2.camel@localhost.localdomain> References: <1157004951.3967.10.camel@localhost.localdomain> <1157097453.4070.2.camel@localhost.localdomain> Message-ID: <44F7F0AF.9090101@weitershausen.de> Nikolay Kim wrote: >>> And always remember our motto: We accept patches :). >> here patch that allow use browser:icon to define icon for zmi >> it works with Five-1.4 but i don't see any problems with other versions > > seems Five doesn't need this patch.. Sorry, I haven't yet found the time to review it. Please be patient with us :). From optilude at gmx.net Mon Sep 11 02:25:50 2006 From: optilude at gmx.net (Martin Aspeli) Date: Mon, 11 Sep 2006 01:25:50 +0100 Subject: [z3-five] Using for security assertions Message-ID: Hi, Having spent some time in AccessControl/ImplPython.py I'm wondering... I got an error "the container contains no security assertions" (via verbose-security) when trying to do context/aq_explicit in a page template. I thought I had provided some security assertions, by using the directive. Obviously I must've done something wrong. This is the relevant code. This is from http://svn.plone.org/svn/plone/plone.app.portlets/trunk/plone/app/portlets/portlets and in classic.py: class IClassicPortlet(...): template = schema.TextLine(...) macro = schema.TextLine(...) class ClassicPortletAssignment(Implicit, Contained): implements(IClassicPortlet def __init__(self, template=u'', macro=u''): self.template = template self.macro = macro Now - mixing in OFS.SimpleItem.SimpleItem instead of Acquisition.Implicit in that class does make the code work again. I don't really understand why, but I guess it enables at least some of the security assertions (i.e. those that are checked in this case). So what am I doing wrong? I thought the directive would've taken care of it all for me :-/ Martin From cues7a at yahoo.es Mon Sep 11 11:45:56 2006 From: cues7a at yahoo.es (Daniel de la Cuesta) Date: Mon, 11 Sep 2006 11:45:56 +0200 (CEST) Subject: [z3-five] AddMenuItem in five Message-ID: <20060911094556.15957.qmail@web26808.mail.ukl.yahoo.com> Hi everybody, I am new in Zope world. My problem is this: I want to add a new product to my list of available objects using Five. I can do that Zope recognise my Product in the Product list but I does not apper in my list of available products. I know how can i do it in Zope 3: "" I have seen in the five manual that the "addMenuItem" directive is not supporte by five, so my question is: ?How can add my product to my list of available objects and make and instance of it? Is there any way to do that using Five or I have to do it at Zope 2 manner? Thank you, Daniel. --------------------------------- LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y m?viles desde 1 c?ntimo por minuto. http://es.voice.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20060911/1a990e14/attachment.htm From maciej.wisniowski at coig.katowice.pl Mon Sep 11 12:12:18 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Mon, 11 Sep 2006 12:12:18 +0200 Subject: [z3-five] AddMenuItem in five In-Reply-To: <20060911094556.15957.qmail@web26808.mail.ukl.yahoo.com> References: <20060911094556.15957.qmail@web26808.mail.ukl.yahoo.com> Message-ID: <45053682.2020402@coig.katowice.pl> > How can add my product to my list of available objects and make and > instance of it? Is there any way to do that using Five or I have to do > it at Zope 2 manner? You may use addform directive like: and in registerClass: declare 'addview' to be same as 'name' defined with addform. Your MainModuleFactory may be: def MainModuleFactory(view, id, title, default_conn_id): cf = MainModule(id, title, default_conn_id) return cf.__of__(view.context) -- Maciej Wisniowski From maciej.wisniowski at coig.katowice.pl Mon Sep 11 13:54:33 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Mon, 11 Sep 2006 13:54:33 +0200 Subject: [z3-five] AddMenuItem in five In-Reply-To: <45053682.2020402@coig.katowice.pl> References: <20060911094556.15957.qmail@web26808.mail.ukl.yahoo.com> <45053682.2020402@coig.katowice.pl> Message-ID: <45054E79.2090502@coig.katowice.pl> Daniel, please, stay on the mailing list. These messages may be useful for the others and for us if someone will correct something etc. > I donnot understand what's the MainModuleFactory. > Is this a new module that creates an instance of my object? MainModuleFactory (you may call it MyFactory or MyClassFactory) is simply a function that creates instance of your class. So say you may have: main_module.py: class MainModule(Folder): """MainModule""" implements(IMainModule) isPrincipiaFolderish = 1 def __init__(self, id, title, default_conn_id): self.id = id self.title = title self.default_conn_id = default_conn_id (...) def MainModuleFactory(view, id, title, default_conn_id): cf = MainModule(id, title, default_conn_id) return cf.__of__(view.context) interfaces.py: class IMainModule(Interface): title = TextLine( title=_("Title"), required=False, description=_("The title of the MainModule.")) default_conn_id = Choice( title=_(u"Default connection id"), vocabulary='ConnectionVocabulary', description=_(u"Identifier of the default connection id"), required=True) And the rest is in zcml (in my previous message). It works, but there are a bit different solutions too. You ma want to take a look at Five/form/tests or Five/docs/products/ViewsTutorial or http://svn.nuxeo.org/trac/pub/browser/Zope2/CalZope/trunk/browser (configure.zcml and adding.py). I was learning about all of these from CalZope. Thanks Nuxeo :) -- Maciej Wisniowski From maciej.wisniowski at coig.katowice.pl Mon Sep 11 14:42:56 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Mon, 11 Sep 2006 14:42:56 +0200 Subject: [z3-five] AddMenuItem in five In-Reply-To: <45054E79.2090502@coig.katowice.pl> References: <20060911094556.15957.qmail@web26808.mail.ukl.yahoo.com> <45053682.2020402@coig.katowice.pl> <45054E79.2090502@coig.katowice.pl> Message-ID: <450559D0.4050002@coig.katowice.pl> Again... why you're not sending your messages to the list??! > What about "name='main_module_addform'" in ZCML? Directive: or if you changed name in addform it may be: It is a pair here: addform and registerClass. > What's main_module_addform is it an html page with a form or a method? Name of the view. -- Maciej Wisniowski From cues7a at yahoo.es Tue Sep 12 09:29:19 2006 From: cues7a at yahoo.es (Daniel de la Cuesta) Date: Tue, 12 Sep 2006 09:29:19 +0200 (CEST) Subject: [z3-five] AddMenuItem in five In-Reply-To: <450559D0.4050002@coig.katowice.pl> Message-ID: <20060912072919.3052.qmail@web26804.mail.ukl.yahoo.com> Maciej Wisniowski escribi?: Again... why you're not sending your messages to the list??! Sorry, > What about "name='main_module_addform'" in ZCML? Directive: ... name="main_module_addform" ... says that the view for adding your content will be '@@main_module_addform'. You may call this 'addMe' or whatever you want but you have to point to same name with registerClass 'addview' attribute: (...) addview="main_module_addform" /> or if you changed name in addform it may be: (...) addview="addMe" /> It is a pair here: addform and registerClass. > What's main_module_addform is it an html page with a form or a method? Name of the view. -- Maciej Wisniowski Ok, I have followed all the steps, here is a summary: 1.- I want to create a zope product and add it to my drop and down list of available items using "Five". 2.- I have my interfaces.py module and my Main_Module.py files: class MainModule(Folder): """MainModule""" implements(IMainModule) isPrincipiaFolderish = 1 def __init__(self, id, title, default_conn_id): self.id = id self.title = title self.default_conn_id = default_conn_id (...) def MainModuleFactory(view, id, title, default_conn_id): cf = MainModule(id, title, default_conn_id) return cf.__of__(view.context) 3.- In my configure.zcml I have: and in registerClass: Finally, when I run zope I get the following error in my configure.zcml file: NameError: name '_' is not defined --------------------------------- LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y m?viles desde 1 c?ntimo por minuto. http://es.voice.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20060912/c8b4f4bc/attachment-0001.htm From regebro at gmail.com Tue Sep 12 10:02:01 2006 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 12 Sep 2006 10:02:01 +0200 Subject: [z3-five] AddMenuItem in five In-Reply-To: <20060912072919.3052.qmail@web26804.mail.ukl.yahoo.com> References: <450559D0.4050002@coig.katowice.pl> <20060912072919.3052.qmail@web26804.mail.ukl.yahoo.com> Message-ID: <319e029f0609120102p70785dd6jf29c18c3ddc36c1e@mail.gmail.com> On 9/12/06, Daniel de la Cuesta wrote: > Finally, when I run zope I get the following error in my configure.zcml > file: > > NameError: name '_' is not defined Then you have, somewhere in your python files, used _ without defining it. _ is not a magic name, although it looks magic. It's just a variable that needs to be defined just like everything else. It's usually defined to MessageFactory('domainname') and used for translations. From cues7a at yahoo.es Tue Sep 12 10:26:17 2006 From: cues7a at yahoo.es (Daniel de la Cuesta) Date: Tue, 12 Sep 2006 10:26:17 +0200 (CEST) Subject: [z3-five] AddMenuItem in five In-Reply-To: <319e029f0609120102p70785dd6jf29c18c3ddc36c1e@mail.gmail.com> Message-ID: <20060912082617.50620.qmail@web26801.mail.ukl.yahoo.com> Lennart Regebro escribi?: On 9/12/06, Daniel de la Cuesta wrote: > Finally, when I run zope I get the following error in my configure.zcml > file: > > NameError: name '_' is not defined Then you have, somewhere in your python files, used _ without defining it. _ is not a magic name, although it looks magic. It's just a variable that needs to be defined just like everything else. It's usually defined to MessageFactory('domainname') and used for translations. Ok, problem solved. The problem was the declaration of the schema in the inferfaces.py module. This is the correct form: text = Text( title=u"Text", description=u"The text of the example.", required=True) Instead of: text = Text( title=_u("Text)", description=_u("The text of the example."), required=True) Now I have another problem :-(: I have my product registered (I can see it in the listo of products in the ZMI), and I have my product in the drop and down list of available items to add. When I add an instance of my product I get the following error in the ZMI: Zope has encountered a problem publishing your object. Cannot locate object at: http://localhost:8080/temp_folder/%2B/main_module_addform This error refers to the following lines of the ZMI: Maciej told me that main_module_addforms are view but where do I have to implement them? Is this the equivalent manage_addMain_ModuleForm and manage_addMain_Module? Do I have to implement then like in zope 2? Do I have to create and html page to view the form? I have a lot of doubts about that, Thank you --------------------------------- LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y m?viles desde 1 c?ntimo por minuto. http://es.voice.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20060912/c0e2c1af/attachment.htm From maciej.wisniowski at coig.katowice.pl Tue Sep 12 10:53:00 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Tue, 12 Sep 2006 10:53:00 +0200 Subject: [z3-five] AddMenuItem in five In-Reply-To: <20060912082617.50620.qmail@web26801.mail.ukl.yahoo.com> References: <20060912082617.50620.qmail@web26801.mail.ukl.yahoo.com> Message-ID: <4506756C.4010002@coig.katowice.pl> > Zope has encountered a problem publishing your object. > Cannot locate object at: > http://localhost:8080/temp_folder/%2B/main_module_addform > > This error refers to the following lines of the ZMI: > > ... > name="main_module_addform" > ... > > > ... > addview="main_module_addform" > /> > Take a look at your's event.log to see if you have no errors like 'Zope couldn't install Five' or run your zope with ./zopectl fg - it won't start if there are any errors and you'll see these errors on console. -- Maciej Wisniowski From cues7a at yahoo.es Tue Sep 12 11:09:32 2006 From: cues7a at yahoo.es (Daniel de la Cuesta) Date: Tue, 12 Sep 2006 11:09:32 +0200 (CEST) Subject: [z3-five] AddMenuItem in five In-Reply-To: <4506756C.4010002@coig.katowice.pl> Message-ID: <20060912090932.44965.qmail@web26808.mail.ukl.yahoo.com> Maciej Wisniowski escribi?: > Zope has encountered a problem publishing your object. > Cannot locate object at: > http://localhost:8080/temp_folder/%2B/main_module_addform > > This error refers to the following lines of the ZMI: > > > ... > name="main_module_addform" > ... > > > > ... > addview="main_module_addform" > /> > Take a look at your's event.log to see if you have no errors like 'Zope couldn't install Five' or run your zope with ./zopectl fg - it won't start if there are any errors and you'll see these errors on console. -- Maciej Wisniowski Zope starts correctly. No problems installing Five during Zope start up. I have run ./zopectl fg and everything ok. The problem is when I want to add my item in the drop and down list of available items. --------------------------------- LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y m?viles desde 1 c?ntimo por minuto. http://es.voice.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20060912/fa0f31af/attachment.htm From regebro at gmail.com Tue Sep 12 13:55:22 2006 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 12 Sep 2006 13:55:22 +0200 Subject: [z3-five] AddMenuItem in five In-Reply-To: <20060912082617.50620.qmail@web26801.mail.ukl.yahoo.com> References: <319e029f0609120102p70785dd6jf29c18c3ddc36c1e@mail.gmail.com> <20060912082617.50620.qmail@web26801.mail.ukl.yahoo.com> Message-ID: <319e029f0609120455y71a16ab8pe6ccc738328ca171@mail.gmail.com> On 9/12/06, Daniel de la Cuesta wrote: > Ok, problem solved. The problem was the declaration of the schema in the > inferfaces.py module. This is the correct form: Well, neither are incorrect. The one with _(u"something") is used when you want to make the text translatable. > http://localhost:8080/temp_folder/%2B/main_module_addform > This error refers to the following lines of the ZMI: > > > ... > name="main_module_addform" > ... > > > > ... > addview="main_module_addform" > /> Yes. Addforms are created on Addviews, which are called "+". (That's the somewhat cryptic %2B in the URL). You don't seem to have the Addview, and I don't know how to set it up (it changed since I did it in Five last time). -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From restless.being at gmail.com Tue Sep 12 15:15:33 2006 From: restless.being at gmail.com (eXt) Date: Tue, 12 Sep 2006 15:15:33 +0200 Subject: [z3-five] AddMenuItem in five In-Reply-To: <20060912072919.3052.qmail@web26804.mail.ukl.yahoo.com> References: <20060912072919.3052.qmail@web26804.mail.ukl.yahoo.com> Message-ID: <200609121515.33809.restless.being@gmail.com> Dnia wtorek, 12 wrze?nia 2006 09:29, Daniel de la Cuesta napisa?: > 3.- In my configure.zcml I have: (...) > ? ? ? ? ? ? ? ? ? ? ? ?class="Products.MyProduct.main_module.MainModule" > ? ? ? ? ? ? ?interface="Products.MyProduct.main_module.MainModule" > ? ? ? ? ?/> This part is not neccessary. You already have: class MainModule(Folder): ? ? """MainModule""" ? ? implements(IMainModule) (...) What's more there is a typo in your five:implements, you used MainModule and it should be IMainModule. Your problems may also be caused by the lack of such zcml snippet: HTH -- eXt From richard at iopen.net Wed Sep 13 04:46:25 2006 From: richard at iopen.net (Richard Waid) Date: Wed, 13 Sep 2006 14:46:25 +1200 Subject: [z3-five] Using Five page templates from inside Zope2 Message-ID: <1158115585.8122.9.camel@ubuntu> Hi: I have a page template defined, and declared with a Five ZCML directive: --- --- >From a different page template defined from _within_ Five, I can access the macros just fine. When I try and access the 'page' macro from a page template within Zope2 (ie. one created in the ZODB) as: metal:use-macro="context/@@gs_template/page" I get an UnauthorizedError: --- Module ZPublisher.Publish, line 120, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 42, in call_object * Module Shared.DC.Scripts.Bindings, line 311, in __call__ * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec * Module Products.PageTemplates.ZopePageTemplate, line 255, in _exec * Module Products.PageTemplates.PageTemplate, line 104, in pt_render * Module TAL.TALInterpreter, line 238, in __call__ * Module TAL.TALInterpreter, line 281, in interpret * Module TAL.TALInterpreter, line 735, in do_useMacro * Module Products.PageTemplates.TALES, line 221, in evaluate URL: /sites/sample/Content/blarg/index.xml Line 1, Column 0 Expression: standard:'here/@@gs_template/page' Names: {'container': , 'context': , 'default': , 'here': , 'loop': , 'modules': , 'nothing': None, 'options': {'args': ()}, 'repeat': , 'request': , 'root': , 'template': , 'traverse_subpath': [], 'user': } * Module Products.PageTemplates.Expressions, line 185, in __call__ * Module Products.PageTemplates.Expressions, line 173, in _eval * Module Products.PageTemplates.Expressions, line 127, in _eval __traceback_info__: here * Module Products.PageTemplates.Expressions, line 338, in restrictedTraverse __traceback_info__: {'path': ['@@gs_template', 'page'], 'TraversalRequestNameStack': []} Unauthorized: You are not allowed to access 'a particular list' in this context --- I have found references to security problems doing things like this, but they weren't clear about solutions (and they were reasonably old). This is Five 1.4, Zope-2.9. Any advice gratefully accepted, including ways to fix Five or workarounds! --Richard From regebro at gmail.com Wed Sep 13 10:56:05 2006 From: regebro at gmail.com (Lennart Regebro) Date: Wed, 13 Sep 2006 10:56:05 +0200 Subject: [z3-five] Using Five page templates from inside Zope2 In-Reply-To: <1158115585.8122.9.camel@ubuntu> References: <1158115585.8122.9.camel@ubuntu> Message-ID: <319e029f0609130156g235a823aye310c14007faba97@mail.gmail.com> On 9/13/06, Richard Waid wrote: > metal:use-macro="context/@@gs_template/page" metal:use-macro="context/@@gs_template/macros/page" ? -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From philipp at weitershausen.de Wed Sep 13 11:48:05 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 13 Sep 2006 11:48:05 +0200 Subject: [z3-five] Using Five page templates from inside Zope2 In-Reply-To: <319e029f0609130156g235a823aye310c14007faba97@mail.gmail.com> References: <1158115585.8122.9.camel@ubuntu> <319e029f0609130156g235a823aye310c14007faba97@mail.gmail.com> Message-ID: <4507D3D5.6020901@weitershausen.de> Lennart Regebro wrote: > On 9/13/06, Richard Waid wrote: >> metal:use-macro="context/@@gs_template/page" > > metal:use-macro="context/@@gs_template/macros/page" ? No. View objects (e.g. context/@@gs_template) have a __getitem__ method that looks up macros of the template. So context/@@gs_template/page is correct. From cues7a at yahoo.es Wed Sep 13 12:01:30 2006 From: cues7a at yahoo.es (Daniel de la Cuesta) Date: Wed, 13 Sep 2006 12:01:30 +0200 (CEST) Subject: [z3-five] AddMenuItem in five In-Reply-To: <200609121515.33809.restless.being@gmail.com> Message-ID: <20060913100130.60050.qmail@web26802.mail.ukl.yahoo.com> eXt escribi?: Your problems may also be caused by the lack of such zcml snippet: HTH -- eXt _______________________________________________ z3-five mailing list z3-five at codespeak.net http://codespeak.net/mailman/listinfo/z3-five Hi, I have included in my configure.zcml file but when I try to add my product I get the same error message: http://localhost:8080/Ejemplos/%2B/main_module_addform ----- Daniel. --------------------------------- LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y m?viles desde 1 c?ntimo por minuto. http://es.voice.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20060913/d21eaae7/attachment.htm From philipp at weitershausen.de Wed Sep 13 12:05:06 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 13 Sep 2006 12:05:06 +0200 Subject: [z3-five] Using Five page templates from inside Zope2 In-Reply-To: <1158115585.8122.9.camel@ubuntu> References: <1158115585.8122.9.camel@ubuntu> Message-ID: <4507D7D2.4000405@weitershausen.de> Richard Waid wrote: > Unauthorized: You are not allowed to access 'a particular list' in this > context Hi, I have a hunch as to what this might be about (missing security declarations for __getitem__). Could you round up a unit test (probably ZopeTestCase based) that demonstrates this problem with the smallest reproducible templates? I could then poke around how to fix it. Out of curiosity: Does this also happen on Zope 2.10? Philipp From maciej.wisniowski at coig.katowice.pl Wed Sep 13 12:34:45 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Wed, 13 Sep 2006 12:34:45 +0200 Subject: [z3-five] AddMenuItem in five In-Reply-To: <20060913100130.60050.qmail@web26802.mail.ukl.yahoo.com> References: <20060913100130.60050.qmail@web26802.mail.ukl.yahoo.com> Message-ID: <4507DEC5.1090307@coig.katowice.pl> > I have included > > > Try with one more line: -- Maciej Wisniowski From cues7a at yahoo.es Wed Sep 13 12:46:31 2006 From: cues7a at yahoo.es (Daniel de la Cuesta) Date: Wed, 13 Sep 2006 12:46:31 +0200 (CEST) Subject: [z3-five] AddMenuItem in five In-Reply-To: <4507DEC5.1090307@coig.katowice.pl> Message-ID: <20060913104632.71792.qmail@web26805.mail.ukl.yahoo.com> Maciej Wisniowski escribi?: > I have included > > > Try with one more line: -- Maciej Wisniowski I have tried and i continue getting the same error. Here is my configure.zcml file, maybe something it 's wrong: --------------------------------- LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y m?viles desde 1 c?ntimo por minuto. http://es.voice.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20060913/154eed7a/attachment.htm From philipp at weitershausen.de Wed Sep 13 13:23:19 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 13 Sep 2006 13:23:19 +0200 Subject: [z3-five] AddMenuItem in five In-Reply-To: <4507DEC5.1090307@coig.katowice.pl> References: <20060913100130.60050.qmail@web26802.mail.ukl.yahoo.com> <4507DEC5.1090307@coig.katowice.pl> Message-ID: <4507EA27.4020303@weitershausen.de> Maciej Wisniowski wrote: >> I have included >> >> >> > Try with one more line: > > Dont' forget OFS.Folder.Folder. From richard at iopen.net Thu Sep 14 01:10:01 2006 From: richard at iopen.net (Richard Waid) Date: Thu, 14 Sep 2006 11:10:01 +1200 Subject: [z3-five] Using Five page templates from inside Zope2 In-Reply-To: <4507D7D2.4000405@weitershausen.de> References: <1158115585.8122.9.camel@ubuntu> <4507D7D2.4000405@weitershausen.de> Message-ID: <1158189001.12698.13.camel@ubuntu> On Wed, 2006-09-13 at 12:05 +0200, Philipp von Weitershausen wrote: > Richard Waid wrote: > > Unauthorized: You are not allowed to access 'a particular list' in this > > context > I have a hunch as to what this might be about (missing security > declarations for __getitem__). Could you round up a unit test (probably > ZopeTestCase based) that demonstrates this problem with the smallest > reproducible templates? I could then poke around how to fix it. Having a few 'issues' getting the test case working: I can get the zope-side content to instantiate (and attempt to render), but it doesn't seem to be loading the Five stuff ... hopefully I'll still manage to work it out. Anyway, in the meantime I've attached a minimal set of files that triggers the problem, with the following zope-side content: -- HELLO WORLD! -- > Out of curiosity: Does this also happen on Zope 2.10? I've just tested this and ... no, it doesn't happen on Zope 2.10b2! Thanks for your help with this, --Richard -------------- next part -------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20060914/76702321/attachment.htm From richard at iopen.net Thu Sep 14 01:13:49 2006 From: richard at iopen.net (Richard Waid) Date: Thu, 14 Sep 2006 11:13:49 +1200 Subject: [z3-five] Using Five page templates from inside Zope2 In-Reply-To: <319e029f0609130156g235a823aye310c14007faba97@mail.gmail.com> References: <1158115585.8122.9.camel@ubuntu> <319e029f0609130156g235a823aye310c14007faba97@mail.gmail.com> Message-ID: <1158189229.12698.17.camel@ubuntu> On Wed, 2006-09-13 at 10:56 +0200, Lennart Regebro wrote: > On 9/13/06, Richard Waid wrote: > > metal:use-macro="context/@@gs_template/page" > > metal:use-macro="context/@@gs_template/macros/page" ? Nice try Lennart, but as Philipp points out, the page template view does this: -- # short cut to get to macros more easily def __getitem__(self, name): if name == 'macros': return self.index.macros return self.index.macros[name] -- So I guess it should still work with 'macros' but it's no longer necessary. --Richard From cues7a at yahoo.es Thu Sep 14 08:53:28 2006 From: cues7a at yahoo.es (Daniel de la Cuesta) Date: Thu, 14 Sep 2006 08:53:28 +0200 (CEST) Subject: [z3-five] AddMenuItem in five In-Reply-To: <4507EA27.4020303@weitershausen.de> Message-ID: <20060914065328.32217.qmail@web26802.mail.ukl.yahoo.com> Philipp von Weitershausen escribi?: Maciej Wisniowski wrote: >> I have included >> >> >> > Try with one more line: > > Dont' forget OFS.Folder.Folder. _______________________________________________ z3-five mailing list z3-five at codespeak.net http://codespeak.net/mailman/listinfo/z3-five I have added all those lines I get the same error: "An error was encountered while publishing this resource. Debugging Notice Zope has encountered a problem publishing your object. Cannot locate object at: http://localhost:8080/%2B/main_module_addform" I have seen in the many examples and demos that they use and html file as the argument of the atributes name and addview in the configure.zcml file: Example: Maybe I have to try that? Thank you. --------------------------------- LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y m?viles desde 1 c?ntimo por minuto. http://es.voice.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/z3-five/attachments/20060914/4845a0cd/attachment.htm From apm13 at columbia.edu Tue Sep 19 01:52:18 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Mon, 18 Sep 2006 16:52:18 -0700 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> Message-ID: <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> OK, it seems there are random cases where the IDefaultBrowserLayer interface has not been applied to the request object. This seems really strange to me. Philipp, five folks, any idea why this might happen? Alec On 9/17/06, Alec Mitchell wrote: > I've seen this error lately, and would very much like to get to the > bottom of it. However, the fact that it seems impossible to reproduce > consistently makes it quite difficult. Could you file an issue in the > tracker at dev.plone.org with any details that you might think are > relevant. > > Thanks, > Alec > > On 9/17/06, Vanessa wrote: > > > > > > gerry rodman writes: > > > > > > > > Zope 2.9.2 > > > Plone 2.5 > > > Python 2.4.3 > > > Fedora Core 4 > > > > > > In about 5% of my read only operations I am getting and attribute error > > > raised naming that attribute as plone. > > > > > > I am getting this error intermittently when performing various actions > > > such as viewing a document for editing or selecting a document for > > > viewing from quick search. Sometimes I get it when initiating the > > > display of a site map. I even got it when trying to view the error log > > > (via the plone control panel) for an earlier occurrence of the error. > > > > > > When the error occurs, and I immediately retry the action, the second > > > try has alway executed successfully (without the error). > > > > > > Has anyone else experienced this? > > > Does anyone have a fix or at least a suggestion as to why it is happening? > > > > Gerry > > > > I am experiencing exactly the same. My difference in setup is i'm using zope > > 2.9.4 running on gentoo. > > > > I've read as much as possible and googled as much as possible and I cannot find > > the answer. My attribute errors also go on hard refresh and when you append / > > at end (Safari). > > > > Some documentation points to view methods, and I've been round the houses on > > other fixes. Everything seems to at one point or another point back to > > bobo_traverse. We are using Squid not > > Apache > > > > If you've found a fix pse pse pse pse pse let me know. Its getting to the point > > that its unbearable. :-( > > > > Regards, Vanessa > > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > Plone-Users mailing list > > Plone-Users at lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/plone-users > > > From chris at simplistix.co.uk Tue Sep 19 08:58:04 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 19 Sep 2006 07:58:04 +0100 Subject: [z3-five] Does Five support Local Utilities? Message-ID: <450F94FC.40607@simplistix.co.uk> Hi All, Does Five support local utilities? If so, what version of Five/Zope do I need? Are there any example out there? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Tue Sep 19 10:24:11 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 19 Sep 2006 10:24:11 +0200 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450F94FC.40607@simplistix.co.uk> References: <450F94FC.40607@simplistix.co.uk> Message-ID: <450FA92B.3030603@weitershausen.de> Chris Withers wrote: > Does Five support local utilities? Short answer: yup. > If so, what version of Five/Zope do I need? Five 1.2 introduced a local site manager implementation with a much simpler, but slightly weird API for easy component registration. At the time, local utilities were really complex to do in Zope 3, so Five certainly made it easier, but perhaps too easy. What Five does in versions 1.2 thru 1.4 really is a cheat. Zope 2.10/Five 1.5 allow you to use Zope 3.3's new local component registries which make things vastly simpler in both Zope 2 and Zope 3. And it's certainly cleaner in Zope 2, also because Zope 2 doesn't invent its own machinery but uses the standard one from Zope 3. > Are there any example out there? I think CPSSharedCalendar uses the old style Five utilities (Lennart can tell you more), but I guess it'll be ported to the new way as well. Martin Aspeli and Hanno Schlichting have some good examples for local utilities done the Zope 3.3 way. Search their blogs or wait for their replies :) Philipp From chris at simplistix.co.uk Tue Sep 19 10:27:04 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 19 Sep 2006 09:27:04 +0100 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450FA92B.3030603@weitershausen.de> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> Message-ID: <450FA9D8.4060608@simplistix.co.uk> Philipp von Weitershausen wrote: > Chris Withers wrote: >> Does Five support local utilities? > > Short answer: yup. Yay! >> If so, what version of Five/Zope do I need? > > Five 1.2 introduced a local site manager implementation with a much > simpler, but slightly weird API for easy component registration. At the > time, local utilities were really complex to do in Zope 3, so Five > certainly made it easier, but perhaps too easy. What Five does in > versions 1.2 thru 1.4 really is a cheat. > > Zope 2.10/Five 1.5 allow you to use Zope 3.3's new local component > registries which make things vastly simpler in both Zope 2 and Zope 3. > And it's certainly cleaner in Zope 2, also because Zope 2 doesn't invent > its own machinery but uses the standard one from Zope 3. Okay, what ships with Zope 2.9? (Since 2.10 still isn't out) > Martin Aspeli and Hanno Schlichting have some good examples for local > utilities done the Zope 3.3 way. Search their blogs or wait for their > replies :) Would be interested to see it. In particular, these utilities are along the lines of the catalog indexes example I gave on zope3-users, and so could be local to a single object. Is that supported? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From regebro at gmail.com Tue Sep 19 10:47:49 2006 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 19 Sep 2006 10:47:49 +0200 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450FA92B.3030603@weitershausen.de> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> Message-ID: <319e029f0609190147g4b67405fhfdf809dd41cf0b4d@mail.gmail.com> On 9/19/06, Philipp von Weitershausen wrote: > I think CPSSharedCalendar uses the old style Five utilities (Lennart can > tell you more), but I guess it'll be ported to the new way as well. Yup. Check out the CalZope source for more info. Web: http://svn.nuxeo.org/trac/pub/browser/Zope2/CalZope Svn: http://svn.nuxeo.org/pub/Zope2/CalZope/trunk From philipp at weitershausen.de Tue Sep 19 10:50:29 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 19 Sep 2006 10:50:29 +0200 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450FA9D8.4060608@simplistix.co.uk> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> <450FA9D8.4060608@simplistix.co.uk> Message-ID: <450FAF55.3000000@weitershausen.de> Chris Withers wrote: > Philipp von Weitershausen wrote: >> Chris Withers wrote: >>> Does Five support local utilities? >> >> Short answer: yup. > > Yay! > >>> If so, what version of Five/Zope do I need? >> >> Five 1.2 introduced a local site manager implementation with a much >> simpler, but slightly weird API for easy component registration. At >> the time, local utilities were really complex to do in Zope 3, so Five >> certainly made it easier, but perhaps too easy. What Five does in >> versions 1.2 thru 1.4 really is a cheat. >> >> Zope 2.10/Five 1.5 allow you to use Zope 3.3's new local component >> registries which make things vastly simpler in both Zope 2 and Zope 3. >> And it's certainly cleaner in Zope 2, also because Zope 2 doesn't >> invent its own machinery but uses the standard one from Zope 3. > > Okay, what ships with Zope 2.9? (Since 2.10 still isn't out) Dude: $ cat $ZOPE_HOME/lib/python/Products/version.txt RTFM! :) >> Martin Aspeli and Hanno Schlichting have some good examples for local >> utilities done the Zope 3.3 way. Search their blogs or wait for their >> replies :) > > Would be interested to see it. In particular, these utilities are along > the lines of the catalog indexes example I gave on zope3-users, and so > could be local to a single object. Is that supported? There is no "local to a single object". The zope.component lookup functions will query the currently active site manager, which is typically set during traversal. If that site manager has the utility registered you want to lookup, it'll be found. If not, lookup will cascade to site managers higher up the hierarchy. It's acquisition, Zope 3 style. Philipp From chris at simplistix.co.uk Tue Sep 19 11:07:19 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 19 Sep 2006 10:07:19 +0100 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450FAF55.3000000@weitershausen.de> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> <450FA9D8.4060608@simplistix.co.uk> <450FAF55.3000000@weitershausen.de> Message-ID: <450FB347.8030600@simplistix.co.uk> Philipp von Weitershausen wrote: > There is no "local to a single object". The zope.component lookup > functions will query the currently active site manager, which is > typically set during traversal. If that site manager has the utility > registered you want to lookup, it'll be found. If not, lookup will > cascade to site managers higher up the hierarchy. It's acquisition, Zope > 3 style. Oh, this sucks :-( I can't get the semantics I'm after unless I do nasty things: (pseudo-ish code) from copy import deepcopy from twiddler.interfaces import IInput from twiddler.zope2.interfaces import IConfigurableComponent from zope.component import getUtility def setInput(self,name): input = getUtility(IInput,name) if IConfigurableComponent.providedBy(input): input = deepcopy(input) self.input = input ...in order to be able to configure the input for that particular Twiddler instance, without that configuration affection the use of the input in all instances that use it. I don't know how evil the above it, would be interested on people's views... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Tue Sep 19 11:15:33 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 19 Sep 2006 11:15:33 +0200 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450FB347.8030600@simplistix.co.uk> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> <450FA9D8.4060608@simplistix.co.uk> <450FAF55.3000000@weitershausen.de> <450FB347.8030600@simplistix.co.uk> Message-ID: <450FB535.3020208@weitershausen.de> Chris Withers wrote: > Philipp von Weitershausen wrote: >> There is no "local to a single object". Actually, I lied. The Component Architecture has the semantics of a componetn that's specifically looked up for one or more objects: adapter. >> The zope.component lookup functions will query the currently active >> site manager, which is typically set during traversal. If that site >> manager has the utility registered you want to lookup, it'll be >> found. If not, lookup will cascade to site managers higher up the >> hierarchy. It's acquisition, Zope 3 style. > > Oh, this sucks :-( Whatever. > I can't get the semantics I'm after unless I do nasty things: > > (pseudo-ish code) > > from copy import deepcopy > from twiddler.interfaces import IInput > from twiddler.zope2.interfaces import IConfigurableComponent > from zope.component import getUtility > > def setInput(self,name): > input = getUtility(IInput,name) > if IConfigurableComponent.providedBy(input): > input = deepcopy(input) > self.input = input > > ...in order to be able to configure the input for that particular > Twiddler instance, without that configuration affection the use of the > input in all instances that use it. > > I don't know how evil the above it, would be interested on people's > views... I don't understand the pseudo code above. What's your goal? From chris at simplistix.co.uk Tue Sep 19 11:43:03 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 19 Sep 2006 10:43:03 +0100 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450FB535.3020208@weitershausen.de> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> <450FA9D8.4060608@simplistix.co.uk> <450FAF55.3000000@weitershausen.de> <450FB347.8030600@simplistix.co.uk> <450FB535.3020208@weitershausen.de> Message-ID: <450FBBA7.4010008@simplistix.co.uk> Philipp von Weitershausen wrote: >> def setInput(self,name): >> input = getUtility(IInput,name) >> if IConfigurableComponent.providedBy(input): >> input = deepcopy(input) >> self.input = input >> >> ...in order to be able to configure the input for that particular >> Twiddler instance, without that configuration affection the use of the >> input in all instances that use it. >> >> I don't know how evil the above it, would be interested on people's >> views... > > I don't understand the pseudo code above. What's your goal? Hmm, IInput is a bad example here, lets switch to IOutput... The same code above applies, just replace "Input" with "Output" There are true global utilities that require no configuration that implement IOutput, such as the default output renderer which takes the Twiddler DOM and turns it into a lump of text: from twiddler.interfaces import IOutput from *somewhere* import _render def Default(root,*args,**kw): output = [] _render(output, root._root, {}) return u''.join(output) directlyProvides(Default,IOutput) This is easy enough to expose through the following zcml: However, I was hoping to use something like utilities for objects that implement the same interface but which require configuration. For example, Twiddler has an output renderer that returns an email.MIMEMultiPart-ish object which also has a send method: class Email: implements(IOutput) def __init__(self, smtp_host='localhost', smtp_port='25', mfrom=None, mto=None,...etc...) # do stuff pass def __call__(self,root,*args,**kw): # gubbinz goes here return MTMultipart(self, values['mfrom'], values['mto'], **multipart_kw) As you can see, this has configuration that is likely to be specific to the individual Twiddler: who the email is to, what smtp server to use, etc. Of course, you *might* want to share this between several twiddlers if, for example, you're sending several different mails but that all share the same From address and use the same smtp server. I currently have this registered using the following zcml: ...which, given what you've told me previously, is why I have the deepcopy in the Twiddler.setInput pseudocode above. The logic is roughly "if the input/output/whatever if configurable, then copy it and store the copy, otherwise just store a reference to the global utility"... Is that evil? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Tue Sep 19 12:01:13 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 19 Sep 2006 12:01:13 +0200 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450FBBA7.4010008@simplistix.co.uk> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> <450FA9D8.4060608@simplistix.co.uk> <450FAF55.3000000@weitershausen.de> <450FB347.8030600@simplistix.co.uk> <450FB535.3020208@weitershausen.de> <450FBBA7.4010008@simplistix.co.uk> Message-ID: <450FBFE9.4010006@weitershausen.de> Chris Withers wrote: > There are true global utilities that require no configuration that > implement IOutput, such as the default output renderer which takes the > Twiddler DOM and turns it into a lump of text: > > from twiddler.interfaces import IOutput > from *somewhere* import _render > def Default(root,*args,**kw): > output = [] > _render(output, root._root, {}) > return u''.join(output) > directlyProvides(Default,IOutput) > > This is easy enough to expose through the following zcml: > > component="twiddler.output.default.Default" > name="Default"/> I see. > However, I was hoping to use something like utilities for objects that > implement the same interface but which require configuration. Right. > For example, Twiddler has an output renderer that returns an > email.MIMEMultiPart-ish object which also has a send method: > > class Email: > > implements(IOutput) > > def __init__(self, > smtp_host='localhost', > smtp_port='25', > mfrom=None, > mto=None,...etc...) > # do stuff > pass > > > def __call__(self,root,*args,**kw): > # gubbinz goes here > return MTMultipart(self, > values['mfrom'], > values['mto'], > **multipart_kw) (Interlude: Note that Zope 3 has a decent mail framework that's transaction aware and all that, so while you might want to create the mail message yourself, you probably want to use zope.sendmail [zope.app.mail previously] for sending it out. Plus, it feels weird to do the mail sending in an twiddler output renderer, but I don't know the framework... ) > As you can see, this has configuration that is likely to be specific to > the individual Twiddler: who the email is to, what smtp server to use, > etc. Of course, you *might* want to share this between several twiddlers > if, for example, you're sending several different mails but that all > share the same From address and use the same smtp server. > > I currently have this registered using the following zcml: > > factory="twiddler.output.emailer.Email" > name="Emailer"/> > > ...which, given what you've told me previously, is why I have the > deepcopy in the Twiddler.setInput pseudocode above. The logic is roughly > "if the input/output/whatever if configurable, then copy it and store > the copy, otherwise just store a reference to the global utility"... > > Is that evil? At least storing the twiddler tree in the global utility seems weird to me. I *think* you could express all this better through adapters. Let's take the first example: class DefaultRenderer(object): adapts(ITwiddler) implements(IOutput) def __init__(self, context): self.context = context def __call__(self, *args, **kw): root = self.context return u''.join(_render(output, root._root, {})) The mail rendering could be expressed with a different adapter: class MailRenderer(DefaultRenderer): adapts(IMailTwiddler) smtp_host = 'localhost' smtp_port = 25 mfrom = None mto = None def __call__(self, *args, **kw): return MTMultipart(self, values['mfrom'], values['mto'], **multipart_kw).to_string() Now you would just register different incarnations of this mail renderer (with different configuration values) for your various twiddlers. The only downside is that you need marker interfaces to express this properly. Or you use named adapters. Philipp From regebro at gmail.com Tue Sep 19 12:05:11 2006 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 19 Sep 2006 12:05:11 +0200 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450FBBA7.4010008@simplistix.co.uk> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> <450FA9D8.4060608@simplistix.co.uk> <450FAF55.3000000@weitershausen.de> <450FB347.8030600@simplistix.co.uk> <450FB535.3020208@weitershausen.de> <450FBBA7.4010008@simplistix.co.uk> Message-ID: <319e029f0609190305h2ab53910s9c740d6f995101a4@mail.gmail.com> On 9/19/06, Chris Withers wrote: > ...which, given what you've told me previously, is why I have the > deepcopy in the Twiddler.setInput pseudocode above. The logic is roughly > "if the input/output/whatever if configurable, then copy it and store > the copy, otherwise just store a reference to the global utility"... > > Is that evil? I would say so, yes. You are trying to use a utiloty as both a utility and as a placeholder for object settings. It really doesn't make much sense. If you need a twiddler per object, the utility should probably be a twiddler factory. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From chris at simplistix.co.uk Tue Sep 19 12:25:55 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 19 Sep 2006 11:25:55 +0100 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <450FBFE9.4010006@weitershausen.de> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> <450FA9D8.4060608@simplistix.co.uk> <450FAF55.3000000@weitershausen.de> <450FB347.8030600@simplistix.co.uk> <450FB535.3020208@weitershausen.de> <450FBBA7.4010008@simplistix.co.uk> <450FBFE9.4010006@weitershausen.de> Message-ID: <450FC5B3.3060804@simplistix.co.uk> Philipp von Weitershausen wrote: > (Interlude: > > Note that Zope 3 has a decent mail framework that's transaction aware > and all that, so while you might want to create the mail message > yourself, you probably want to use zope.sendmail [zope.app.mail > previously] for sending it out. Yup, bear in mind that Twiddler is not aimed soley at Zope ;-) I'd imagine there would be an IOutput for Zope 2 that subclasses emailer.Email and uses a MailHost for Zope 2, and something similar for Zope 3 that uses zope.sendmail or a Zope 3 MailHost equivalent... > Plus, it feels weird to do the mail > sending in an twiddler output renderer, but I don't know the framework... > ) You don't have to, but it can be convenient. The output essentially just renders the mail, you can send it whenever you want: msg = t.render(mto=('philipp at weitershausen.de',),as_message=True) f = open('virus.bin','rb') msg.add_file(f) msg.send() ...you could even choose to send the mail using something else: smtp.send(you_from,your_to,msg.as_string()) > At least storing the twiddler tree in the global utility seems weird to > me. That doesn't happen, a copy of the utility is stored as an attribute of the Twiddler, which is how the plain python version works, as shown by this snippet from ITwiddler: input = Attribute(""" An object implementing IInput. If this attribute is set, then setSource should be called with the original or new source to re-parse it. NB: No checking is done when this attribute is set, be careful! """) > I *think* you could express all this better through adapters. Let's > take the first example: > > class DefaultRenderer(object): > adapts(ITwiddler) > implements(IOutput) > > def __init__(self, context): > self.context = context > > def __call__(self, *args, **kw): > root = self.context > return u''.join(_render(output, root._root, {})) > > The mail rendering could be expressed with a different adapter: > > class MailRenderer(DefaultRenderer): > adapts(IMailTwiddler) > > smtp_host = 'localhost' > smtp_port = 25 > mfrom = None > mto = None > > def __call__(self, *args, **kw): > return MTMultipart(self, > values['mfrom'], > values['mto'], > **multipart_kw).to_string() > > Now you would just register different incarnations of this mail renderer > (with different configuration values) for your various twiddlers. The > only downside is that you need marker interfaces to express this > properly. Or you use named adapters. Yeah, this feels like too much Zope kool aid to me. I'm happy to have Twiddler depend on zope.interface, since it's becoming the defacto python interface implementation, and I'm happy to rely on zope.testing is you want to run the tests, purely 'cos the doctest is better, but making twiddler reliant on zope.component is not what I want. The utility stuff I'm playing with is mainly to help build and configure Twiddlers under Zope 2. How well do adapters play in the Zope2/Five world? As a specific question, how would I build a TTW configurable set of adapters and a UI to pick and choose between them? For example, there's also IExectutor, which specifies where to find code to execute at render time, as a a simple example for Zope 2 land, I want to be able to do something akin to: t = Twiddler('...etc..', executor=Zope2Traverser('/folder/python_script')) where Zope2Traverser is something like: class Zope2Traverser: implements(IExecutor) def __init__(self,path): self.path = path def __call__(self): return self.unrestrictedTraverse(self.path) In the adapter model, how would you see IExecutor panning out? Where would I put the '/folder/python_script' and how would I configure it, bearing in mind that it might be different for each and every Twiddler? cheers, Chris PS: Interestingly, in Zope 3, none of this will likely be an issue, since the Twiddler will be set up in the BrowserView, likely as a class attribute, and can be constructed using the plain-python twiddler semantics. However, this issue does return as soon as they become configurably TTW ;-) -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Tue Sep 19 12:34:09 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 19 Sep 2006 11:34:09 +0100 Subject: [z3-five] Does Five support Local Utilities? In-Reply-To: <319e029f0609190305h2ab53910s9c740d6f995101a4@mail.gmail.com> References: <450F94FC.40607@simplistix.co.uk> <450FA92B.3030603@weitershausen.de> <450FA9D8.4060608@simplistix.co.uk> <450FAF55.3000000@weitershausen.de> <450FB347.8030600@simplistix.co.uk> <450FB535.3020208@weitershausen.de> <450FBBA7.4010008@simplistix.co.uk> <319e029f0609190305h2ab53910s9c740d6f995101a4@mail.gmail.com> Message-ID: <450FC7A1.30404@simplistix.co.uk> Lennart Regebro wrote: > I would say so, yes. You are trying to use a utiloty as both a utility > and as a placeholder for object settings. It really doesn't make much > sense. > If you need a twiddler per object, the utility should probably be a > twiddler factory. It's an input parser per twiddler object, but yeah, I thought about that. It seems an awful lot of extraneous code though :-/ (I have to register factories for utilities even where the utility is a simple python function, and I need several new interfaces: IInputFactory, IOutputFactory, IExecutorFactory,IFilterFactory) I dunno, I think Lennart is "right" here, but that "factory" attribute to the utility directive is hard to ignore... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From apm13 at columbia.edu Tue Sep 19 15:33:44 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Tue, 19 Sep 2006 06:33:44 -0700 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> Message-ID: <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> On 9/19/06, Sasha Vincic wrote: > >>> gerry rodman writes: > >>>> > >>>> In about 5% of my read only operations I am getting and > >>>> attribute error > >>>> raised naming that attribute as plone. > >>>> > > The reason you get this error is due some error before. It can be an > unresolved ConflictError due some even third error or just some other > error and it's hidden as AttributeError: @@plone, please scroll back > in your event.log and try to find the errors before the ending > AttributeError: @@plone So why are conflict errors causing IDefaultBrowserLayer to not be applied to the request? And why are conflict errors happening on read operations in zope 2.9? Alec From apm13 at columbia.edu Tue Sep 19 16:56:45 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Tue, 19 Sep 2006 07:56:45 -0700 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> Message-ID: <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> On 9/19/06, Sasha Vincic wrote: > > On Sep 19, 2006, at 15:33, Alec Mitchell wrote: > > > On 9/19/06, Sasha Vincic wrote: > >> >>> gerry rodman writes: > >> >>>> > >> >>>> In about 5% of my read only operations I am getting and > >> >>>> attribute error > >> >>>> raised naming that attribute as plone. > >> >>>> > >> > >> The reason you get this error is due some error before. It can be an > >> unresolved ConflictError due some even third error or just some other > >> error and it's hidden as AttributeError: @@plone, please scroll back > >> in your event.log and try to find the errors before the ending > >> AttributeError: @@plone > > > > So why are conflict errors causing IDefaultBrowserLayer to not be > > applied to the request? And why are conflict errors happening on read > > operations in zope 2.9? > > In my case it was that one of the products did some changes that had > to be written and sometimes they failed. So for the conflict error in > z2.9 (I didn't know they shouldn't appear in read only) i suspect > that there is a badly designed product and for IDefaultBrowserLayer > thing I don't know. Yeah, for me it was a bad product. However, the fact that Five is automatically failing to lookup views on a post-ConflictError retry is a very very bad thing, IMO. It means that ConflictErrors, which were once relatively innocuous except in extreme cases are now guaranteed to cause an end-user visible failure. This is not at all acceptable, IMHO. Alec From philipp at weitershausen.de Tue Sep 19 17:04:17 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 19 Sep 2006 17:04:17 +0200 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> Message-ID: <451006F1.4020309@weitershausen.de> Alec Mitchell wrote: > On 9/19/06, Sasha Vincic wrote: >> >> On Sep 19, 2006, at 15:33, Alec Mitchell wrote: >> >> > On 9/19/06, Sasha Vincic wrote: >> >> >>> gerry rodman writes: >> >> >>>> >> >> >>>> In about 5% of my read only operations I am getting and >> >> >>>> attribute error >> >> >>>> raised naming that attribute as plone. >> >> >>>> >> >> >> >> The reason you get this error is due some error before. It can be an >> >> unresolved ConflictError due some even third error or just some other >> >> error and it's hidden as AttributeError: @@plone, please scroll back >> >> in your event.log and try to find the errors before the ending >> >> AttributeError: @@plone >> > >> > So why are conflict errors causing IDefaultBrowserLayer to not be >> > applied to the request? And why are conflict errors happening on read >> > operations in zope 2.9? >> >> In my case it was that one of the products did some changes that had >> to be written and sometimes they failed. So for the conflict error in >> z2.9 (I didn't know they shouldn't appear in read only) i suspect >> that there is a badly designed product and for IDefaultBrowserLayer >> thing I don't know. > > Yeah, for me it was a bad product. However, the fact that Five is > automatically failing to lookup views on a post-ConflictError retry is > a very very bad thing, IMO. It means that ConflictErrors, which were > once relatively innocuous except in extreme cases are now guaranteed > to cause an end-user visible failure. This is not at all acceptable, > IMHO. Do we have proof that this is Five's fault, IOW, that the request is *actually* missing IDefaultBrowserLayer? Or is this just an assumption? Alec, is this a reasonably recent Zope 2.9 installation? In general, the rule is that whoever creates the request also has to apply the default skins. We modified the ZPublisher to do that. It could be that due to the retry functionality that is invoked before ConflictErrors occur, a new request w/o the default skin is created. In that case the problem is within ZPublisher's retry functionality. That's all I can say with the few information I know so far. Whoever is experiencing the ConflictError should debug the problem further to check where the AttributeError is actually coming from. From apm13 at columbia.edu Tue Sep 19 17:08:39 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Tue, 19 Sep 2006 08:08:39 -0700 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: <451006F1.4020309@weitershausen.de> References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> <451006F1.4020309@weitershausen.de> Message-ID: <365118370609190808yd1e8949t34e3fa0f90fb3832@mail.gmail.com> On 9/19/06, Philipp von Weitershausen wrote: > Alec Mitchell wrote: > Do we have proof that this is Five's fault, IOW, that the request is > *actually* missing IDefaultBrowserLayer? Or is this just an assumption? > Alec, is this a reasonably recent Zope 2.9 installation? Not necessarily that it's Five's fault but that IDefaultBrowserLayer is missing from the request, I determined/confirmed this in a pdb session after triggering a ConflictError. If I manually applied that interface to the request during the pdb session using alsoProvides then the request succeeded, otherwise I got an AttributeError. This is 2.9.4-final with Five-1.4 svn, I have not really attempted to reproduce this on 2.9 svn though. > In general, the rule is that whoever creates the request also has to > apply the default skins. We modified the ZPublisher to do that. It could > be that due to the retry functionality that is invoked before > ConflictErrors occur, a new request w/o the default skin is created. In > that case the problem is within ZPublisher's retry functionality. That sounds pretty likely. Can we fix this for Zope 2.9.5? Alec From philipp at weitershausen.de Tue Sep 19 17:12:20 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 19 Sep 2006 17:12:20 +0200 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: <365118370609190808yd1e8949t34e3fa0f90fb3832@mail.gmail.com> References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> <451006F1.4020309@weitershausen.de> <365118370609190808yd1e8949t34e3fa0f90fb3832@mail.gmail.com> Message-ID: <451008D4.4030705@weitershausen.de> Alec Mitchell wrote: > On 9/19/06, Philipp von Weitershausen wrote: >> Alec Mitchell wrote: >> Do we have proof that this is Five's fault, IOW, that the request is >> *actually* missing IDefaultBrowserLayer? Or is this just an assumption? >> Alec, is this a reasonably recent Zope 2.9 installation? > > Not necessarily that it's Five's fault but that IDefaultBrowserLayer > is missing from the request, I determined/confirmed this in a pdb > session after triggering a ConflictError. If I manually applied that > interface to the request during the pdb session using alsoProvides > then the request succeeded, otherwise I got an AttributeError. This > is 2.9.4-final with Five-1.4 svn, I have not really attempted to > reproduce this on 2.9 svn though. Ok, that's exactly what I was wondering. Thanks for making that clearer. >> In general, the rule is that whoever creates the request also has to >> apply the default skins. We modified the ZPublisher to do that. It could >> be that due to the retry functionality that is invoked before >> ConflictErrors occur, a new request w/o the default skin is created. In >> that case the problem is within ZPublisher's retry functionality. > > That sounds pretty likely. Can we fix this for Zope 2.9.5? Sure. You have my gracious permission to do so ;) From apm13 at columbia.edu Tue Sep 19 17:15:52 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Tue, 19 Sep 2006 08:15:52 -0700 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: <451008D4.4030705@weitershausen.de> References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> <451006F1.4020309@weitershausen.de> <365118370609190808yd1e8949t34e3fa0f90fb3832@mail.gmail.com> <451008D4.4030705@weitershausen.de> Message-ID: <365118370609190815p462fdd56ofdaf884b2d504ffc@mail.gmail.com> On 9/19/06, Philipp von Weitershausen wrote: > Alec Mitchell wrote: > > On 9/19/06, Philipp von Weitershausen wrote: > >> Alec Mitchell wrote: > >> Do we have proof that this is Five's fault, IOW, that the request is > >> *actually* missing IDefaultBrowserLayer? Or is this just an assumption? > >> Alec, is this a reasonably recent Zope 2.9 installation? > > > > Not necessarily that it's Five's fault but that IDefaultBrowserLayer > > is missing from the request, I determined/confirmed this in a pdb > > session after triggering a ConflictError. If I manually applied that > > interface to the request during the pdb session using alsoProvides > > then the request succeeded, otherwise I got an AttributeError. This > > is 2.9.4-final with Five-1.4 svn, I have not really attempted to > > reproduce this on 2.9 svn though. > > Ok, that's exactly what I was wondering. Thanks for making that clearer. > > >> In general, the rule is that whoever creates the request also has to > >> apply the default skins. We modified the ZPublisher to do that. It could > >> be that due to the retry functionality that is invoked before > >> ConflictErrors occur, a new request w/o the default skin is created. In > >> that case the problem is within ZPublisher's retry functionality. > > > > That sounds pretty likely. Can we fix this for Zope 2.9.5? > > Sure. You have my gracious permission to do so ;) Well that much I figured, of course I have very little idea where to start looking on this one. ;-) Alec From apm13 at columbia.edu Tue Sep 19 17:20:01 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Tue, 19 Sep 2006 08:20:01 -0700 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: <365118370609190815p462fdd56ofdaf884b2d504ffc@mail.gmail.com> References: <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> <451006F1.4020309@weitershausen.de> <365118370609190808yd1e8949t34e3fa0f90fb3832@mail.gmail.com> <451008D4.4030705@weitershausen.de> <365118370609190815p462fdd56ofdaf884b2d504ffc@mail.gmail.com> Message-ID: <365118370609190820j34eff103u2b56df11f6f8ad96@mail.gmail.com> On 9/19/06, Alec Mitchell wrote: > On 9/19/06, Philipp von Weitershausen wrote: > > Alec Mitchell wrote: > > > On 9/19/06, Philipp von Weitershausen wrote: > > >> Alec Mitchell wrote: > > >> Do we have proof that this is Five's fault, IOW, that the request is > > >> *actually* missing IDefaultBrowserLayer? Or is this just an assumption? > > >> Alec, is this a reasonably recent Zope 2.9 installation? > > > > > > Not necessarily that it's Five's fault but that IDefaultBrowserLayer > > > is missing from the request, I determined/confirmed this in a pdb > > > session after triggering a ConflictError. If I manually applied that > > > interface to the request during the pdb session using alsoProvides > > > then the request succeeded, otherwise I got an AttributeError. This > > > is 2.9.4-final with Five-1.4 svn, I have not really attempted to > > > reproduce this on 2.9 svn though. > > > > Ok, that's exactly what I was wondering. Thanks for making that clearer. > > > > >> In general, the rule is that whoever creates the request also has to > > >> apply the default skins. We modified the ZPublisher to do that. It could > > >> be that due to the retry functionality that is invoked before > > >> ConflictErrors occur, a new request w/o the default skin is created. In > > >> that case the problem is within ZPublisher's retry functionality. > > > > > > That sounds pretty likely. Can we fix this for Zope 2.9.5? > > > > Sure. You have my gracious permission to do so ;) > > Well that much I figured, of course I have very little idea where to > start looking on this one. OK, looks like the fix is easy enough (a new request is being generated on retry in Publish.py, so we apply the skin to it), the test is probably going to be a bit trickier though. ;-) Alec From philipp at weitershausen.de Tue Sep 19 17:22:06 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Tue, 19 Sep 2006 17:22:06 +0200 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: <365118370609190815p462fdd56ofdaf884b2d504ffc@mail.gmail.com> References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> <451006F1.4020309@weitershausen.de> <365118370609190808yd1e8949t34e3fa0f90fb3832@mail.gmail.com> <451008D4.4030705@weitershausen.de> <365118370609190815p462fdd56ofdaf884b2d504ffc@mail.gmail.com> Message-ID: <45100B1E.6020906@weitershausen.de> Alec Mitchell wrote: > On 9/19/06, Philipp von Weitershausen wrote: >> Alec Mitchell wrote: >> > On 9/19/06, Philipp von Weitershausen wrote: >> >> Alec Mitchell wrote: >> >> Do we have proof that this is Five's fault, IOW, that the request is >> >> *actually* missing IDefaultBrowserLayer? Or is this just an >> assumption? >> >> Alec, is this a reasonably recent Zope 2.9 installation? >> > >> > Not necessarily that it's Five's fault but that IDefaultBrowserLayer >> > is missing from the request, I determined/confirmed this in a pdb >> > session after triggering a ConflictError. If I manually applied that >> > interface to the request during the pdb session using alsoProvides >> > then the request succeeded, otherwise I got an AttributeError. This >> > is 2.9.4-final with Five-1.4 svn, I have not really attempted to >> > reproduce this on 2.9 svn though. >> >> Ok, that's exactly what I was wondering. Thanks for making that clearer. >> >> >> In general, the rule is that whoever creates the request also has to >> >> apply the default skins. We modified the ZPublisher to do that. It >> could >> >> be that due to the retry functionality that is invoked before >> >> ConflictErrors occur, a new request w/o the default skin is >> created. In >> >> that case the problem is within ZPublisher's retry functionality. >> > >> > That sounds pretty likely. Can we fix this for Zope 2.9.5? >> >> Sure. You have my gracious permission to do so ;) > > Well that much I figured, of course I have very little idea where to > start looking on this one. ;-) Try the attached patch (against 2.10, but should work on 2.9). Basically, retrying a request means creating a new request object. The patch now also sets the default skin for the new request object. HTH -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: retryskin.patch Url: http://codespeak.net/pipermail/z3-five/attachments/20060919/ef04ccba/attachment.diff From limi at plone.org Wed Sep 20 01:38:45 2006 From: limi at plone.org (Alexander Limi) Date: Tue, 19 Sep 2006 16:38:45 -0700 Subject: [z3-five] plone/zope conflict errors and plone attribute error References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> <451006F1.4020309@weitershausen.de> <125BB054AB3DCA77882FB62D@vanessa-evans-computer.local> Message-ID: On Tue, 19 Sep 2006 09:07:18 -0700, Vanessa Evans wrote: > Thus I've had to hire a consultant to investigate this from a Plone level > just to make sure that it isn't something fixable from within Plone - an > error that I've propogated. It's definitely an error on the Zope or Five level, so a Plone consultant probably won't be able to do much. Conflict Errors are usually a bit hardcore to debug. ;) That being said, it looks like Philipp and Alec are on top of it, and it should be able to be included in the next Zope 2.9 and 2.10 releases. Of course, if you're confident enough to apply Philipp's patch and give us feedback on whether that fixes your instance, that would be very very helpful. Thanks! -- _____________________________________________________________________ Alexander Limi ? Chief Architect ? Plone Solutions ? Norway Consulting ? Training ? Development ? http://www.plonesolutions.com _____________________________________________________________________ Plone Co-Founder ? http://plone.org ? Connecting Content Plone Foundation ? http://plone.org/foundation ? Protecting Plone From chris at simplistix.co.uk Wed Sep 20 09:54:14 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 20 Sep 2006 08:54:14 +0100 Subject: [z3-five] zcml questions Message-ID: <4510F3A6.4030104@simplistix.co.uk> Hi All, If Have have the following in a product's configure.zcml: ...how come getUtilitiesFor(IExecutorFactory) returns the one for Traverse before the one for None? Also, if a site administrator wanted to "unregister" one of these in site.zcml, maybe because they didn't want the Traverse executor to be available, how would they go about doing that? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Wed Sep 20 10:20:27 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 20 Sep 2006 09:20:27 +0100 Subject: [z3-five] Object modification events? Message-ID: <4510F9CB.50200@simplistix.co.uk> Hi All, I see Zope 2.9 now emits events from ObjectManager for adds and deletes. Is there any support for object modification events? Would each class (eg: ZopePageTemplate, PythonScript, etc) each have to generate these at the appropriate points? Does/should PropertyManager do the same for each of its methods? Also, does anyone have any good event subscriber examples for adds and deletes (yeah, I'm gonna be doing cataloging with these ;-) ) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Wed Sep 20 11:12:06 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 20 Sep 2006 11:12:06 +0200 Subject: [z3-five] Object modification events? In-Reply-To: <4510F9CB.50200@simplistix.co.uk> References: <4510F9CB.50200@simplistix.co.uk> Message-ID: <451105E6.2080500@weitershausen.de> Chris Withers wrote: > Hi All, > > I see Zope 2.9 now emits events from ObjectManager for adds and deletes. > > Is there any support for object modification events? Sure. zope.event.notify(ObjectModifiedEvent(obj)). > Would each class (eg: ZopePageTemplate, PythonScript, etc) each have to > generate these at the appropriate points? > > Does/should PropertyManager do the same for each of its methods? Yes. Basically, whoever changes an object also has the responsibility to send the appopriate events. Zope 2 is surely not sending enough of them at this point. > Also, does anyone have any good event subscriber examples for adds and > deletes (yeah, I'm gonna be doing cataloging with these ;-) ) Cool. zope.app.catalog.catalog has an example, zope.app.intid as well. Philipp From philipp at weitershausen.de Wed Sep 20 11:15:34 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Wed, 20 Sep 2006 11:15:34 +0200 Subject: [z3-five] zcml questions In-Reply-To: <4510F3A6.4030104@simplistix.co.uk> References: <4510F3A6.4030104@simplistix.co.uk> Message-ID: <451106B6.4010609@weitershausen.de> Chris Withers wrote: > Hi All, > > If Have have the following in a product's configure.zcml: > > component="twiddler.zope2.factories.no_executor" > name="None"/> > > component="twiddler.zope2.factories.traverse_executor" > name="Traverse"/> > > ...how come getUtilitiesFor(IExecutorFactory) returns the one for > Traverse before the one for None? AFAIK, getUtilitiesFor is not supposed to order these in any way. While the returned iterator does find them in a reproduceable order due to the implementation, you shouldn't rely on that. > Also, if a site administrator wanted to "unregister" one of these in > site.zcml, maybe because they didn't want the Traverse executor to be > available, how would they go about doing that? ZCML has no way of unregistering specific utilities or adapters (though there's a Python API). In ZCML we typically define "features" and apply a condition using the feature: From apm13 at columbia.edu Thu Sep 21 01:32:41 2006 From: apm13 at columbia.edu (Alec Mitchell) Date: Wed, 20 Sep 2006 16:32:41 -0700 Subject: [z3-five] [Plone-Users] plone/zope conflict errors and plone attribute error In-Reply-To: <125BB054AB3DCA77882FB62D@vanessa-evans-computer.local> References: <365118370609172104p3971badct7b9e5742ca5bd1bd@mail.gmail.com> <365118370609181652l1d647f9akdfbb682bab5d505c@mail.gmail.com> <365118370609190633j65ab5496h9765f85164470b7c@mail.gmail.com> <551467B8-F2AD-4B9E-B48E-E513567AE7E1@lovelysystems.com> <365118370609190756g4ebe0332s5d808807bb1bcfbc@mail.gmail.com> <451006F1.4020309@weitershausen.de> <125BB054AB3DCA77882FB62D@vanessa-evans-computer.local> Message-ID: <365118370609201632m4909dc33j8a4f45d99f99943f@mail.gmail.com> On 9/19/06, Vanessa Evans wrote: > > > --On 19 September 2006 17:04:17 +0200 Philipp von Weitershausen > wrote: > > > Alec Mitchell wrote: > ing I don't know. > >> > >> Yeah, for me it was a bad product. However, the fact that Five is > >> automatically failing to lookup views on a post-ConflictError retry is > >> a very very bad thing, IMO. It means that ConflictErrors, which were > >> once relatively innocuous except in extreme cases are now guaranteed > >> to cause an end-user visible failure. This is not at all acceptable, > >> IMHO. > > > > Do we have proof that this is Five's fault, IOW, that the request is > > *actually* missing IDefaultBrowserLayer? Or is this just an assumption? > > Alec, is this a reasonably recent Zope 2.9 installation? > > > > > > In general, the rule is that whoever creates the request also has to > > apply the default skins. We modified the ZPublisher to do that. It could > > be that due to the retry functionality that is invoked before > > ConflictErrors occur, a new request w/o the default skin is created. In > > that case the problem is within ZPublisher's retry functionality. > > > > > > That's all I can say with the few information I know so far. Whoever is > > experiencing the ConflictError should debug the problem further to check > > where the AttributeError is actually coming from. > > > I am happy to share any information with you. Unfortunately without some > guidance I don't think I will be able to troubleshoot this meaningfully - I > may fix it, but as someone who isn't really a Zope developer - more like a > Zope wannabee, I'm lost on a lot of detail. > > Thus I've had to hire a consultant to investigate this from a Plone level > just to make sure that it isn't something fixable from within Plone - an > error that I've propogated. > > It is a real problem, It seems to happen on views for document_view, > folder_listing, contentpanels_view. I've checked rechecked these files. > There is no failure when working on the site with the port number and > localhost. Sometimes the error goes away with appending a slash at the > end, sometimes not - it requires hard refresh. I thought it was related to > order in skin layers but it turns out that this is not the case. It goes > through stages of failing on prefs_install and prefs_error as well as > login_form. Apart from anything else it is a real ugly error message when > delivered to the end user - not even delivered within Plone templating > system. I even wondered if there was a way to 'catch it' and then force > hard refresh. > > At one point I thought it may be masking a security problem but it isn't. > If someone could help me out a bit or at least let me know what information > may indicate the cause..... There is now a fix in Zope 2.9/2.10/2.11 svn for the issue that was causing ConflictErrors to result in view lookup problems (and AttributeErrors). However, if you are seeing ConflictErrors on "read" operations, it is a good idea to find out what is causing them. Chances are you have something that's naughtily doing writes on read operations. Looking at the object the conflict error triggers on will give you a clue. It's probably some 3rd party product you have installed. Alec From chris at simplistix.co.uk Thu Sep 21 08:49:56 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Thu, 21 Sep 2006 07:49:56 +0100 Subject: [z3-five] zcml questions In-Reply-To: <451106B6.4010609@weitershausen.de> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> Message-ID: <45123614.5020709@simplistix.co.uk> Philipp von Weitershausen wrote: > AFAIK, getUtilitiesFor is not supposed to order these in any way. While > the returned iterator does find them in a reproduceable order due to the > implementation, you shouldn't rely on that. OK, so you should always sort this list when using it for a UI? Hmm, seems odd, is getUtilitiesFor used for anything other than generating UI's? >> Also, if a site administrator wanted to "unregister" one of these in >> site.zcml, maybe because they didn't want the Traverse executor to be >> available, how would they go about doing that? > > ZCML has no way of unregistering specific utilities or adapters (though > there's a Python API). That sucks :-( I thought the whole point of ZCML was that a site manager could override setup in site.zcml. 50% of that aim isn't done if they can't turn stuff off as well as on... Where can the python api for unregistration be found? > In ZCML we typically define "features" and apply > a condition using the feature: Why? So you can have yet another (pointless in this case) layer of indirection?! > > > zcml:condition="have twiddler.defaulttraverser" /> This is missing the point. There are an array of inputs, outputs and traversers available. There's a sensible default set registered, but site managers might have different requirements which are likely to include disabling some of the default registrations. How should I do things such that they can do that? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From philipp at weitershausen.de Thu Sep 21 10:00:48 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 21 Sep 2006 10:00:48 +0200 Subject: [z3-five] zcml questions In-Reply-To: <45123614.5020709@simplistix.co.uk> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> Message-ID: <451246B0.5090201@weitershausen.de> Chris Withers wrote: > Philipp von Weitershausen wrote: >> AFAIK, getUtilitiesFor is not supposed to order these in any way. >> While the returned iterator does find them in a reproduceable order >> due to the implementation, you shouldn't rely on that. > > OK, so you should always sort this list when using it for a UI? If you explicitly want the list to be sorted, sure. The question is how you want it to be sorted. Perhaps not everyone wants it to be sorted by the utility name. Also, getUtilitiesFor is a generator. That makes it efficient if you just get a few utilities, realize you have the one you want and don't get the rest. If you expect a sorted output, you lose that efficiency. > Hmm, seems odd, is getUtilitiesFor used for anything other than > generating UI's? I can't say off of the top of my head. Why don't you grep :) >>> Also, if a site administrator wanted to "unregister" one of these in >>> site.zcml, maybe because they didn't want the Traverse executor to be >>> available, how would they go about doing that? >> >> ZCML has no way of unregistering specific utilities or adapters >> (though there's a Python API). > > That sucks :-( > > I thought the whole point of ZCML was that a site manager could override > setup in site.zcml. 50% of that aim isn't done if they can't turn stuff > off as well as on... Right. I think zcml:condition was a first step into that direction. Its implementation was very use case-driven. It seems you have a use case for more control over ZCML, so it'd be nice to hear from suggestions how you would envision a directive disabling feature in ZCML. > Where can the python api for unregistration be found? On site managers. They have unregister* methods. So, *after* your ZCML has been loaded, you could poke at the global site manager and unregister the utilities that ZCML registered. >> In ZCML we typically define "features" and apply a condition using the >> feature: > > Why? So you can have yet another (pointless in this case) layer of > indirection?! *sigh* We use it quite well in Zope 3 to enable/disable development tools like APIDoc. We have a feature called 'devmode' so all debugging tools can hook into that. APIDoc itself also enables a feature when it is loaded so you can register things with APIDoc, but only if APIDoc is available. zcml:condition also has another verb, "installed", that allows you to load directives only when a certian Python package is available, e.g.: >> >> >> > zcml:condition="have twiddler.defaulttraverser" /> > > This is missing the point. There are an array of inputs, outputs and > traversers available. There's a sensible default set registered, but > site managers might have different requirements which are likely to > include disabling some of the default registrations. Why woudl they have to disable existing ones? Can't they just choose different ones, leaving the default ones sitting there? > How should I do things such that they can do that? I'm just wondering whether you really need the disabling feature. From tseaver at palladion.com Thu Sep 21 15:15:01 2006 From: tseaver at palladion.com (Tres Seaver) Date: Thu, 21 Sep 2006 09:15:01 -0400 Subject: [z3-five] zcml questions In-Reply-To: <451246B0.5090201@weitershausen.de> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> Message-ID: <45129055.40402@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Philipp von Weitershausen wrote: > Chris Withers wrote: >> Philipp von Weitershausen wrote: >>> AFAIK, getUtilitiesFor is not supposed to order these in any way. >>> While the returned iterator does find them in a reproduceable order >>> due to the implementation, you shouldn't rely on that. >> OK, so you should always sort this list when using it for a UI? > > If you explicitly want the list to be sorted, sure. The question is how > you want it to be sorted. Perhaps not everyone wants it to be sorted by > the utility name. > > Also, getUtilitiesFor is a generator. That makes it efficient if you > just get a few utilities, realize you have the one you want and don't > get the rest. If you expect a sorted output, you lose that efficiency. > >> Hmm, seems odd, is getUtilitiesFor used for anything other than >> generating UI's? > > I can't say off of the top of my head. Why don't you grep :) > >>>> Also, if a site administrator wanted to "unregister" one of these in >>>> site.zcml, maybe because they didn't want the Traverse executor to be >>>> available, how would they go about doing that? >>> ZCML has no way of unregistering specific utilities or adapters >>> (though there's a Python API). >> That sucks :-( >> >> I thought the whole point of ZCML was that a site manager could override >> setup in site.zcml. 50% of that aim isn't done if they can't turn stuff >> off as well as on... > > Right. I think zcml:condition was a first step into that direction. Its > implementation was very use case-driven. It seems you have a use case > for more control over ZCML, so it'd be nice to hear from suggestions how > you would envision a directive disabling feature in ZCML. > >> Where can the python api for unregistration be found? > > On site managers. They have unregister* methods. So, *after* your ZCML > has been loaded, you could poke at the global site manager and > unregister the utilities that ZCML registered. > >>> In ZCML we typically define "features" and apply a condition using the >>> feature: >> Why? So you can have yet another (pointless in this case) layer of >> indirection?! > > *sigh* > > We use it quite well in Zope 3 to enable/disable development tools like > APIDoc. We have a feature called 'devmode' so all debugging tools can > hook into that. APIDoc itself also enables a feature when it is loaded > so you can register things with APIDoc, but only if APIDoc is available. > > zcml:condition also has another verb, "installed", that allows you to > load directives only when a certian Python package is available, e.g.: > > package="worldcookery.pdf" /> > >>> >>> >>> >> zcml:condition="have twiddler.defaulttraverser" /> >> This is missing the point. There are an array of inputs, outputs and >> traversers available. There's a sensible default set registered, but >> site managers might have different requirements which are likely to >> include disabling some of the default registrations. > > Why woudl they have to disable existing ones? Can't they just choose > different ones, leaving the default ones sitting there? > >> How should I do things such that they can do that? > > I'm just wondering whether you really need the disabling feature. I've wanted it. My major beef with the way we are *using* ZCML now is that we expect package authors to provide policy-laden configuration for their packages ("sensible defaults") but provide no means for the admin to reuse that configuration selectively; their only realy choice is to *copy* the configuration and edit it. I argued *long* ago (after the first ZC-internal Zope3 sprint, I think) that the '' directive should be allowed to be complex, with subelements like '' or '' to pull in specific directives. Such a practice would require either that we have XPath support available, or else that we come up with a way to mark the directives (e.g., a 'zcml:id' attribute). It would *also* require that we implement the "no side-effects during parsing" policy (my other favorite "dead horse" in arguments about ZCML's implementation / usage). Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFEpBV+gerLs4ltQ4RAlldAJ9FwPgZV3NCE16wXiZGwpljrpZfswCeLwU5 PdZXr3WyOcBeEpcAzEe2QEg= =XbgN -----END PGP SIGNATURE----- From philipp at weitershausen.de Thu Sep 21 15:19:32 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 21 Sep 2006 15:19:32 +0200 Subject: [z3-five] zcml questions In-Reply-To: <45129055.40402@palladion.com> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> Message-ID: <45129164.9020003@weitershausen.de> Tres Seaver wrote: >>> How should I do things such that they can do that? >> I'm just wondering whether you really need the disabling feature. > > I've wanted it. Okay :). > My major beef with the way we are *using* ZCML now is > that we expect package authors to provide policy-laden configuration for > their packages ("sensible defaults") but provide no means for the admin > to reuse that configuration selectively; their only realy choice is to > *copy* the configuration and edit it. True. > I argued *long* ago (after the first ZC-internal Zope3 sprint, I think) > that the '' directive should be allowed to be complex, with > subelements like '' or '' to pull in specific directives. > Such a practice would require either that we have XPath support > available, or else that we come up with a way to mark the directives > (e.g., a 'zcml:id' attribute). Well, we already sort of that this marking with "features" + zcml:condition. But and could be more powerful wrt packages, modules, or even classes and interfaces. > It would *also* require that we > implement the "no side-effects during parsing" policy (my other favorite > "dead horse" in arguments about ZCML's implementation / usage). Yup. I think there are very little side effects currently. I can't think of one off of the top of my head, to be honest (but I'm sure there are). From philipp at weitershausen.de Thu Sep 21 15:50:01 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Thu, 21 Sep 2006 15:50:01 +0200 Subject: [z3-five] zcml questions In-Reply-To: <45129797.4000103@palladion.com> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <45129164.9020003@weitershausen.de> <45129797.4000103@palladion.com> Message-ID: <45129889.6010205@weitershausen.de> Tres Seaver wrote: > We do "eager" checking of dotted names (during the parse), which makes > it impossible to write a directive which synthesisizes the target of a > dotted name without side-effects (e.g., the 'five:bridge' directive). > > If we delayed the check until after parsing was complete, then we could > eliminate one source of side effects. Side-effect-free parsing would > open a lot of possibilities: "ZCML introspector" tools, for instance. Good points! From tseaver at palladion.com Thu Sep 21 15:45:59 2006 From: tseaver at palladion.com (Tres Seaver) Date: Thu, 21 Sep 2006 09:45:59 -0400 Subject: [z3-five] zcml questions In-Reply-To: <45129164.9020003@weitershausen.de> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <45129164.9020003@weitershausen.de> Message-ID: <45129797.4000103@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Philipp von Weitershausen wrote: > Tres Seaver wrote: >>>> How should I do things such that they can do that? >>> I'm just wondering whether you really need the disabling feature. >> >> I've wanted it. > > Okay :). > >> My major beef with the way we are *using* ZCML now is >> that we expect package authors to provide policy-laden configuration for >> their packages ("sensible defaults") but provide no means for the admin >> to reuse that configuration selectively; their only realy choice is to >> *copy* the configuration and edit it. > > True. > >> I argued *long* ago (after the first ZC-internal Zope3 sprint, I think) >> that the '' directive should be allowed to be complex, with >> subelements like '' or '' to pull in specific directives. >> Such a practice would require either that we have XPath support >> available, or else that we come up with a way to mark the directives >> (e.g., a 'zcml:id' attribute). > > Well, we already sort of that this marking with "features" + > zcml:condition. But and could be more powerful wrt > packages, modules, or even classes and interfaces. > >> It would *also* require that we >> implement the "no side-effects during parsing" policy (my other favorite >> "dead horse" in arguments about ZCML's implementation / usage). > > Yup. I think there are very little side effects currently. I can't think > of one off of the top of my head, to be honest (but I'm sure there are). We do "eager" checking of dotted names (during the parse), which makes it impossible to write a directive which synthesisizes the target of a dotted name without side-effects (e.g., the 'five:bridge' directive). If we delayed the check until after parsing was complete, then we could eliminate one source of side effects. Side-effect-free parsing would open a lot of possibilities: "ZCML introspector" tools, for instance. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFEpeX+gerLs4ltQ4RApuDAJ9GW+vIzSOzCQ7vj6iUBpmkh5LeFwCcC29l V2u8kqNL/VJKTXOEPc1Ryl0= =gIbE -----END PGP SIGNATURE----- From jim at zope.com Thu Sep 21 17:17:49 2006 From: jim at zope.com (Jim Fulton) Date: Thu, 21 Sep 2006 11:17:49 -0400 Subject: [z3-five] zcml questions In-Reply-To: <45129055.40402@palladion.com> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> Message-ID: <1DD511CF-6A9F-4281-8054-EA56FBE157DB@zope.com> On Sep 21, 2006, at 9:15 AM, Tres Seaver wrote: > > I've wanted it. My major beef with the way we are *using* ZCML now is > that we expect package authors to provide policy-laden > configuration for > their packages ("sensible defaults") but provide no means for the > admin > to reuse that configuration selectively; their only realy choice > is to > *copy* the configuration and edit it. This is mostly true. I'll note that it is straightforward to override things. It isn't straightforward to disable things, especially subscribers. Anyway, I think you raise a good point. > I argued *long* ago (after the first ZC-internal Zope3 sprint, I > think) > that the '' directive should be allowed to be complex, with > subelements like '' or '' to pull in specific > directives. > Such a practice would require either that we have XPath support > available, or else that we come up with a way to mark the directives > (e.g., a 'zcml:id' attribute). I don't remember this, but I may have been focussed on other things. I definitely think it would be good to have something like this. It would be interesting to see some proposals with examples. > It would *also* require that we > implement the "no side-effects during parsing" policy (my other > favorite > "dead horse" in arguments about ZCML's implementation / usage). Beat away. :) I've been in favor of this for some time. This is definitely a goal. Jim -- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From jim at zope.com Thu Sep 21 17:52:28 2006 From: jim at zope.com (Jim Fulton) Date: Thu, 21 Sep 2006 11:52:28 -0400 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <200609211131.01218.srichter@cosmos.phy.tufts.edu> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> Message-ID: <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> On Sep 21, 2006, at 11:31 AM, Stephan Richter wrote: > On Thursday 21 September 2006 09:15, Tres Seaver wrote: >> I've wanted it. My major beef with the way we are *using* ZCML >> now is >> that we expect package authors to provide policy-laden >> configuration for >> their packages ("sensible defaults") but provide no means for the >> admin >> to reuse that configuration selectively; their only realy choice >> is to >> *copy* the configuration and edit it. > > This has been proposed and approved, but implementation has been > delayed due > to missing XPath features. > > http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ > ZCMLEnhancements I have a feeling that xpath is overkill. It alsoi won't work for actions defined in Python. I'd rather see some sort of identifier system. So, when actions are created, they can have identifiers or properties or something that can be used to filter them out. Any proposal for this, IMO should have a number of well-documented examples. Jim -- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From faassen at infrae.com Fri Sep 22 11:06:50 2006 From: faassen at infrae.com (Martijn Faassen) Date: Fri, 22 Sep 2006 11:06:50 +0200 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> Message-ID: <4513A7AA.50202@infrae.com> Jim Fulton wrote: > > On Sep 21, 2006, at 11:31 AM, Stephan Richter wrote: [snip] >> This has been proposed and approved, but implementation has been >> delayed due to missing XPath features. >> >> http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ZCMLEnhancements >> > > I have a feeling that xpath is overkill. It alsoi won't work for > actions defined in Python. Not hindered by much actual knowledge about this proposal, I share your feeling. It seems to imply working on the level of XML while we want to have something that's working on the semantic level of Zope configuration. This way, if we grow Python-based configuration or automatic configuration, the system will still work. Regards, Martijn From jim at zope.com Fri Sep 22 13:30:41 2006 From: jim at zope.com (Jim Fulton) Date: Fri, 22 Sep 2006 07:30:41 -0400 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <4513A7AA.50202@infrae.com> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> <4513A7AA.50202@infrae.com> Message-ID: <41E78190-BC0F-48BA-9482-DF5F3FE3A3E4@zope.com> On Sep 22, 2006, at 5:06 AM, Martijn Faassen wrote: > Jim Fulton wrote: >> On Sep 21, 2006, at 11:31 AM, Stephan Richter wrote: > [snip] >>> This has been proposed and approved, but implementation has been >>> delayed due to missing XPath features. >>> >>> http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ >>> ZCMLEnhancements >> I have a feeling that xpath is overkill. It alsoi won't work for >> actions defined in Python. > > Not hindered by much actual knowledge about this proposal, I share > your feeling. It seems to imply working on the level of XML while > we want to have something that's working on the semantic level of > Zope configuration. This way, if we grow Python-based configuration > or automatic configuration, the system will still work. Yes (or even an alternate configuration language, which I'm not proposing :) Jim -- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From not.com at gmail.com Sat Sep 23 00:01:17 2006 From: not.com at gmail.com (yary) Date: Fri, 22 Sep 2006 15:01:17 -0700 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone Message-ID: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> Hello, I'm having a devil of a time figuring out how to create a custom content object (and custom folderish object to contain it) using Five (1.4 on zope 2.9.4 - would be willing to try 1.5 & 3.10) with CMF (2.0.0) For reference, so far I've tried: http://worldcookery.com/files/jeffshell-todo/ - this is close to the structure of my project and would be great if it worked with Five. Alas after making several small changes I got to a point where I could go no further: ConfigurationError: ('Unknown directive', u'http://namespaces.zope.org/browser', u'containerViews') - No containerViews?! and then an error about not recognizing zmi_views. http://zissue.berlios.de/z3/Zope3In30Minutes.html - couldn't get it working (not Five specific anyway) http://worldcookery.com/files/ploneconf05-five/ - had to remove the Archetypes references- shouldn't need Archetypes for my project, and anyway Archetypes only works if Plone is installed- still couldn't get it to do anything. http://plone.org/documentation/tutorial/five-zope3-walkthrough - seems very Plone dependant, haven't tried it. I played with the example Five products FiveMiscTutorial, InterfaceTutorial, ViewsTutorial and saw that Five does work as advertised for those examples... thanks in advance From philipp at weitershausen.de Sat Sep 23 01:49:47 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Sat, 23 Sep 2006 01:49:47 +0200 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> Message-ID: <4514769B.1080905@weitershausen.de> yary wrote: > Hello, > > I'm having a devil of a time figuring out how to create a custom > content object (and custom folderish object to contain it) using Five > (1.4 on zope 2.9.4 - would be willing to try 1.5 & 3.10) with CMF > (2.0.0) Create the content object or folderish content object like you would normally do in the CMF. However, implement additional functionality as Zope3 components (e.g. views, adapters). > For reference, so far I've tried: > > http://worldcookery.com/files/jeffshell-todo/ - this is close to the > structure of my project and would be great if it worked with Five. > Alas after making several small changes I got to a point where I could > go no further: ConfigurationError: ('Unknown directive', > u'http://namespaces.zope.org/browser', u'containerViews') - No > containerViews?! and then an error about not recognizing zmi_views. The TODO application is specifically geared towards Zope 3. Five makes no promise that everything from Zope 3 works. > http://zissue.berlios.de/z3/Zope3In30Minutes.html - couldn't get it > working (not Five specific anyway) > > http://worldcookery.com/files/ploneconf05-five/ - had to remove the > Archetypes references- shouldn't need Archetypes for my project, and > anyway Archetypes only works if Plone is installed- still couldn't get > it to do anything. Archetypes work outside of Plone very well. This howto is not very Archetypes specific, really. > I played with the example Five products FiveMiscTutorial, > InterfaceTutorial, ViewsTutorial and saw that Five does work as > advertised for those examples... So, it seems you've been covering a lot of docs already. Is there any *specific* question you have? From not.com at gmail.com Sat Sep 23 03:02:59 2006 From: not.com at gmail.com (yary) Date: Fri, 22 Sep 2006 18:02:59 -0700 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <4514769B.1080905@weitershausen.de> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> <4514769B.1080905@weitershausen.de> Message-ID: <75cbfa570609221802j35c6c787w228b7fb389620554@mail.gmail.com> (accidentally sent this off early to Philipp personally, with a few typos in it) On 22/09/06, Philipp von Weitershausen wrote: > So, it seems you've been covering a lot of docs already. Is there any >*specific* question you have? Is there an example or set of examples that works on Five 1.3, 1.4, or 1.5 showing how to create an interface for a custom object & its implementation, wiring the auto-generated add/edit forms for it into a menu via zcml? The "Zope3 In 30 Minutes" example is close to what I'm looking for. It shows how to add a bookmark and a bookmark container, and put it in a menu, in Zope3. By pulling the factory directives outside of the content directive & adding a component attribute to them, you get zcml that Five 1.4 can understand- but it references a zmi_views menu, which isn't mapped to anything. So I try using "user" instead of "zmi_views", since I recall another tutorial adding to the CMF menus that way, and I then get an error somewhere else: "Unknown directive" "containerViews" ... > ... Five makes no promise that everything from Zope 3 works. Aye, I don't expect all of Zope3, but based on this excerpt from http://codespeak.net/z3/five/ "it allows you to use Zope 3 interfaces, ZCML-based configuration, adapters, browser pages (including skins, layers, and resources), automated add and edit forms based on schemas" I expect something like the 'bookmark' or 'todo' examples to be possible. I would love to see a similar working example in Five, possibly with CMF involved, definitely without Plone or Archtypes. Where is it? That's my specific question... getting off topic here, but- > Archetypes work outside of Plone very well. ... Actually, you cannot use recent (within last two years, at least) versions of Archetypes without also having Plone installed. They are dependant on each other. At least that was my experience with AT 1.4-final, and when I asked, AT developers agreed that Plone is now required. With some hacking I was able to make AT 1.39 mostly work with an older version of the CMF. I feel bad about about using an old library that I have to hack to make it work even partially, so it's not an option for my product. From regebro at gmail.com Sat Sep 23 09:21:13 2006 From: regebro at gmail.com (Lennart Regebro) Date: Sat, 23 Sep 2006 09:21:13 +0200 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> Message-ID: <319e029f0609230021rd990250ic8bdf1b7bda98134@mail.gmail.com> On 9/23/06, yary wrote: > Hello, > > I'm having a devil of a time figuring out how to create a custom > content object (and custom folderish object to contain it) using Five > (1.4 on zope 2.9.4 - would be willing to try 1.5 & 3.10) with CMF > (2.0.0) > > For reference, so far I've tried: CalCMF has no Plone specifics. Maybe it can help. http://svn.nuxeo.org/trac/pub/browser/Zope2/CalCMF From philipp at weitershausen.de Sat Sep 23 11:27:09 2006 From: philipp at weitershausen.de (Philipp von Weitershausen) Date: Sat, 23 Sep 2006 11:27:09 +0200 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <75cbfa570609221755o56cd6a51hacfa3ff36f1008e2@mail.gmail.com> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> <4514769B.1080905@weitershausen.de> <75cbfa570609221755o56cd6a51hacfa3ff36f1008e2@mail.gmail.com> Message-ID: <4514FDED.9050209@weitershausen.de> yary wrote: > On 22/09/06, Philipp von Weitershausen wrote: >> So, it seems you've been covering a lot of docs already. Is there any >> *specific* question you have? > > Is there an example or set of examples that works on Five 1.3, 1.4, or > 1.5 showing how to create an interface for a custom object & its > implementation, wiring the auto-generated add/edit forms it into a > menu via zcml? The interface/schema thing is well documented, so are the add/edit forms (e.g. http://serverzen.net/search?Subject=zope.formlib). As for menus, you should look at Lennart's suggestion. > The "Zope3 In 30 Minutes" example is close to what I'm looking for. It > shows how to add a bookmark and a bookmark container, and put it in a > menu, in Zope3. By pulling the factory directives outside of the > content directive & adding a component attribute to them, you get zcml > that Five 1.4 can understand- but it references a zmi_views menu, > which isn't mapped to anything. Yup. 'zmi_views' is something in Zope 3. > So I try using "user" instead of > "zmi_views", since I recall another tutorial adding to the CMF menus > that way, and I then get an error somewhere else: "Unknown directive" > "containerViews" ... Yup. Zope 2 doesn't yet have the concept of "containers" as it exists in Zope 3. >> ... Five makes no promise that everything from Zope 3 works. > > Aye, I don't expect all of Zope3, but based on this excerpt from > http://codespeak.net/z3/five/ "it allows you to use Zope 3 interfaces, > ZCML-based configuration, adapters, browser pages (including skins, > layers, and resources), automated add and edit forms based on > schemas" I expect something like the bookmark or todo examples to be > possible. I would love to see a working example of something like > those in Five. Where is it? That's my specific question... There is none. Which means you can help improve that situation by writing down what works for you. These tutorials are made by volunteers and we don't have that many of them... > getting off topic here, but- >> Archetypes work outside of Plone very well. ... > > Actually, you cannot use recent (within last two years, at least) > versions of Archetypes without also having Plone installed. They are > dependant on each other. At least that was my experience with AT > 1.4-final, and when I asked, AT developers agreed that Plone is now > required. With some hacking I was able to make AT 1.39 mostly work > with an older version of the CMF. I feel bad about about using an old > library that I have to hack to make it work even partially, so it's > not an option for my product. Okay... I don't like Archetypes anyways, so good choice :) From chris at simplistix.co.uk Mon Sep 25 19:43:16 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 25 Sep 2006 18:43:16 +0100 Subject: [z3-five] zcml questions In-Reply-To: <451246B0.5090201@weitershausen.de> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> Message-ID: <45181534.6060308@simplistix.co.uk> Philipp von Weitershausen wrote: >> This is missing the point. There are an array of inputs, outputs and >> traversers available. There's a sensible default set registered, but >> site managers might have different requirements which are likely to >> include disabling some of the default registrations. > > Why woudl they have to disable existing ones? 'cuz they may not want to expose them to people authoring code ttw. > Can't they just choose > different ones, leaving the default ones sitting there? Nope, disabling is really important, and not just for this. Thing about defining permissions using different names and the like ;-) cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Mon Sep 25 19:41:54 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 25 Sep 2006 18:41:54 +0100 Subject: [z3-five] zcml questions In-Reply-To: <45129055.40402@palladion.com> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> Message-ID: <451814E2.9060902@simplistix.co.uk> Tres Seaver wrote: >>> How should I do things such that they can do that? >> I'm just wondering whether you really need the disabling feature. > > I've wanted it. My major beef with the way we are *using* ZCML now is > that we expect package authors to provide policy-laden configuration for > their packages ("sensible defaults") but provide no means for the admin > to reuse that configuration selectively; their only realy choice is to > *copy* the configuration and edit it. Yes indeed. > I argued *long* ago (after the first ZC-internal Zope3 sprint, I think) > that the '' directive should be allowed to be complex, with > subelements like '' or '' to pull in specific directives. This sounds a bit heavyweight, how about just a "disable" thingy: > (e.g., a 'zcml:id' attribute). It would *also* require that we > implement the "no side-effects during parsing" policy (my other favorite > "dead horse" in arguments about ZCML's implementation / usage). ...yep, my "disable" idea needs this too! Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Mon Sep 25 19:44:58 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 25 Sep 2006 18:44:58 +0100 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <1DD511CF-6A9F-4281-8054-EA56FBE157DB@zope.com> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <1DD511CF-6A9F-4281-8054-EA56FBE157DB@zope.com> Message-ID: <4518159A.3070900@simplistix.co.uk> Jim Fulton wrote: > >> It would *also* require that we >> implement the "no side-effects during parsing" policy (my other favorite >> "dead horse" in arguments about ZCML's implementation / usage). > > Beat away. :) I've been in favor of this for some time. This is > definitely a goal. Can we have a papal edict that zcml that has side effects is a bug? (including the dotted name thing...) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Mon Sep 25 19:50:51 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 25 Sep 2006 18:50:51 +0100 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <4513A7AA.50202@infrae.com> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> <4513A7AA.50202@infrae.com> Message-ID: <451816FB.4030205@simplistix.co.uk> Martijn Faassen wrote: > configuration. This way, if we grow Python-based configuration or > automatic configuration, the system will still work. I do care about this, because "I hate zcml(tm)" but how would you see disabling working in a python-based config? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Mon Sep 25 19:47:30 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 25 Sep 2006 18:47:30 +0100 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <200609211131.01218.srichter@cosmos.phy.tufts.edu> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> Message-ID: <45181632.4090501@simplistix.co.uk> Stephan Richter wrote: > This has been proposed and approved, but implementation has been delayed due > to missing XPath features. > > http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ZCMLEnhancements I like all of the ideas on there, I'm a little confused though. How much of what is on there is actually implemented and where? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Mon Sep 25 19:49:22 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 25 Sep 2006 18:49:22 +0100 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> Message-ID: <451816A2.1050504@simplistix.co.uk> Jim Fulton wrote: > > I have a feeling that xpath is overkill. I wish it was, but I don't think it is.. > It alsoi won't work for > actions defined in Python. Wasn't aware you could do this, where can I find examples? > I'd rather see some sort of identifier system. But that would mean every piece of zcml would need to have an id manually assigned as in id with the assigner ensuring that it's unique. This seems burdensome, xpath feels "right" here, at least imh(umble)o. cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From jim at zope.com Mon Sep 25 20:43:55 2006 From: jim at zope.com (Jim Fulton) Date: Mon, 25 Sep 2006 14:43:55 -0400 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <4518159A.3070900@simplistix.co.uk> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <1DD511CF-6A9F-4281-8054-EA56FBE157DB@zope.com> <4518159A.3070900@simplistix.co.uk> Message-ID: <97FAB08E-BE37-483E-AB31-9CA68C870479@zope.com> On Sep 25, 2006, at 1:44 PM, Chris Withers wrote: > Jim Fulton wrote: >>> It would *also* require that we >>> implement the "no side-effects during parsing" policy (my other >>> favorite >>> "dead horse" in arguments about ZCML's implementation / usage). >> Beat away. :) I've been in favor of this for some time. This is >> definitely a goal. > > Can we have a papal edict that zcml that has side effects is a bug? > (including the dotted name thing...) No, but I'm definitely in favor of refactoring existing handlers so they do pretty much all of their work in the actions they generate. Jim -- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From jim at zope.com Mon Sep 25 20:47:43 2006 From: jim at zope.com (Jim Fulton) Date: Mon, 25 Sep 2006 14:47:43 -0400 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <451816A2.1050504@simplistix.co.uk> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> <451816A2.1050504@simplistix.co.uk> Message-ID: On Sep 25, 2006, at 1:49 PM, Chris Withers wrote: > Jim Fulton wrote: >> I have a feeling that xpath is overkill. > > I wish it was, but I don't think it is.. > >> It alsoi won't work for actions defined in Python. > > Wasn't aware you could do this, where can I find examples? You can't yet. You can't use XPATH either. :) I definately want to make it possible for people to specify actions in Python. > >> I'd rather see some sort of identifier system. > > But that would mean every piece of zcml would need to have an id > manually assigned as in id with the assigner ensuring that it's > unique. Not necessarily. actions already have discriminators which are, essentially ids. What's needed is a way of assigning ids to directives, mainly subscriber definitions, that don't have discriminators. I also think it would be useful to be able to assign ids to groups of configuration to make it easier to disable a collection of things that go together. Jim -- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From tseaver at palladion.com Mon Sep 25 20:50:31 2006 From: tseaver at palladion.com (Tres Seaver) Date: Mon, 25 Sep 2006 14:50:31 -0400 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <97FAB08E-BE37-483E-AB31-9CA68C870479@zope.com> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <1DD511CF-6A9F-4281-8054-EA56FBE157DB@zope.com> <4518159A.3070900@simplistix.co.uk> <97FAB08E-BE37-483E-AB31-9CA68C870479@zope.com> Message-ID: <451824F7.6070106@palladion.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jim Fulton wrote: > On Sep 25, 2006, at 1:44 PM, Chris Withers wrote: > >> Jim Fulton wrote: >>>> It would *also* require that we >>>> implement the "no side-effects during parsing" policy (my other >>>> favorite >>>> "dead horse" in arguments about ZCML's implementation / usage). >>> Beat away. :) I've been in favor of this for some time. This is >>> definitely a goal. >> Can we have a papal edict that zcml that has side effects is a bug? >> (including the dotted name thing...) > > No, but I'm definitely in favor of refactoring existing handlers so > they do pretty much all of their work in the actions they generate. We'll need to remove the parse-time error checking of name resolution then, which means storing filename / line number information with each dotted name so that the failed resolution can be reported when actions are running. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFGCT3+gerLs4ltQ4RAjubAKCAx3bjFDTQIJP2+NljAPNQJcwyYACglvno K4C1uDLz8e4M2MvIy1+w2TA= =srEr -----END PGP SIGNATURE----- From jim at zope.com Mon Sep 25 20:55:59 2006 From: jim at zope.com (Jim Fulton) Date: Mon, 25 Sep 2006 14:55:59 -0400 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <451816FB.4030205@simplistix.co.uk> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> <4513A7AA.50202@infrae.com> <451816FB.4030205@simplistix.co.uk> Message-ID: <14CC7CF5-17C9-496C-91E4-7870C67FDBEF@zope.com> On Sep 25, 2006, at 1:50 PM, Chris Withers wrote: > Martijn Faassen wrote: >> configuration. This way, if we grow Python-based configuration or >> automatic configuration, the system will still work. > > I do care about this, because "I hate zcml(tm)" but how would you > see disabling working in a python-based config? Or some such. Jim -- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From chris at simplistix.co.uk Tue Sep 26 11:54:10 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 26 Sep 2006 10:54:10 +0100 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> <451816A2.1050504@simplistix.co.uk> Message-ID: <4518F8C2.1010301@simplistix.co.uk> Jim Fulton wrote: > I definately want to make it possible for people to specify actions in > Python. Me too :-) > Not necessarily. actions already have discriminators which are, > essentially ids. How do they work? Where can I see examples? > What's needed is a way of assigning ids to directives, > mainly subscriber definitions, that don't have discriminators. Oh, so some directives have descriminators and others don't? > I also > think it would be useful to be able to assign ids to groups of > configuration to make it easier to disable a collection of things that > go together. Yep. Would that cover the devmode use case and allow the deprecation of the crazy "condition" stuff? ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From jim at zope.com Tue Sep 26 13:39:54 2006 From: jim at zope.com (Jim Fulton) Date: Tue, 26 Sep 2006 07:39:54 -0400 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <4518F8C2.1010301@simplistix.co.uk> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> <451816A2.1050504@simplistix.co.uk> <4518F8C2.1010301@simplistix.co.uk> Message-ID: <97467318-9017-4A33-81E2-D4A56223F30E@zope.com> On Sep 26, 2006, at 5:54 AM, Chris Withers wrote: > Jim Fulton wrote: > >> Not necessarily. actions already have discriminators which are, >> essentially ids. > > How do they work? They are used to determine if actions conflict. They arethe basis of conflict detection and overriding. > Where can I see examples? In the zope configuration doc tests. >> What's needed is a way of assigning ids to directives, mainly >> subscriber definitions, that don't have discriminators. > > Oh, so some directives have descriminators and others don't? Yes. Most do. Soe don't because they don't create actions that conflict with anything else. > >> I also think it would be useful to be able to assign ids to groups >> of configuration to make it easier to disable a collection of >> things that go together. > > Yep. Would that cover the devmode use case and allow the > deprecation of the crazy "condition" stuff? ;-) I doubt it. Jim -- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From suresh_vv at yahoo.com Tue Sep 26 16:43:12 2006 From: suresh_vv at yahoo.com (Suresh V.) Date: Tue, 26 Sep 2006 20:13:12 +0530 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <319e029f0609230021rd990250ic8bdf1b7bda98134@mail.gmail.com> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> <319e029f0609230021rd990250ic8bdf1b7bda98134@mail.gmail.com> Message-ID: Lennart Regebro wrote: > On 9/23/06, yary wrote: >> Hello, >> >> I'm having a devil of a time figuring out how to create a custom >> content object (and custom folderish object to contain it) using Five >> (1.4 on zope 2.9.4 - would be willing to try 1.5 & 3.10) with CMF >> (2.0.0) >> >> For reference, so far I've tried: > > CalCMF has no Plone specifics. Maybe it can help. > http://svn.nuxeo.org/trac/pub/browser/Zope2/CalCMF Check out TestableEmailer at http://partecs.com/testableEmailer.html Suresh From suresh_vv at yahoo.com Tue Sep 26 16:59:22 2006 From: suresh_vv at yahoo.com (Suresh V.) Date: Tue, 26 Sep 2006 20:29:22 +0530 Subject: [z3-five] getParentNode() returns View class! Message-ID: I have a method in y content class that calls getParentNode(). def get_output(self): p = self.getParentNode() print p.getId() When called from a method in the View class: context = self.context context.get_output() getParentNode returns the View class and I get: AttributeError: getId What I want is the parent object in the Zope hierarchy. Is this a bug? If not how do I get what I want? Suresh From chris at simplistix.co.uk Tue Sep 26 17:39:27 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Tue, 26 Sep 2006 16:39:27 +0100 Subject: [z3-five] A Quick Event-based Cataloging How-to for Zope 2 Message-ID: <451949AF.7050005@simplistix.co.uk> Hi All, Just been playing with this and found it remarkably easy, so thought I'd pass it on. If anyone can think of a better place than the mailing list archives for this, please let me know! Anyway, so I'm building a Zope 2 app where I need to index objects that are not catalog aware when they're added, modified or removed. To make things harder, this also needs to work via WebDAV. OK, so here's the solution: 1. Create yourself a python module called subscribers.py and put it on your python path, containing the following: from Acquisition import aq_base from zope.interface import Interface class ICatalogAware(Interface): pass def catalog(object,event): if aq_base(object) is object: # ObjectModified can get emitted during creation, # before the object has any acquisition context return object.getPhysicalRoot().unrestrictedTraverse( '/catalog' ).catalog_object(object) def uncatalog(object,event): object.getPhysicalRoot().unrestrictedTraverse( '/catalog' ).uncatalog_object('/'.join(object.getPhysicalPath())) 2. Slap the ICatalogAware marker interface on any classes you want to have indexed. Here's an example for the good old File object. Put the following in your site.zcml: 3. Finally, wire up the events so that files get indexed when they're created, modified or removed, again by adding the following to site.zcml: 4. Okay, sadly you do need to get do some patching if you want changes to the file to result in recataloging :-/ Here's a diff: --- Image.py.original 2006-09-26 16:32:20.759375000 +0100 +++ Image.py 2006-09-26 16:33:11.384375000 +0100 @@ -33,6 +33,8 @@ from ZPublisher.HTTPRequest import FileUpload from ZPublisher.Iterators import filestream_iterator from zExceptions import Redirect +from zope.event import notify +from zope.app.container.contained import ObjectModifiedEvent from cgi import escape import transaction @@ -437,6 +439,7 @@ self.ZCacheable_invalidate() self.ZCacheable_set(None) self.http__refreshEtag() + notify(ObjectModifiedEvent(self)) def manage_edit(self, title, content_type, precondition='', filedata=None, REQUEST=None): Okay, well, hope this helps someone :-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From regebro at gmail.com Tue Sep 26 18:10:35 2006 From: regebro at gmail.com (Lennart Regebro) Date: Tue, 26 Sep 2006 18:10:35 +0200 Subject: [z3-five] getParentNode() returns View class! In-Reply-To: References: Message-ID: <319e029f0609260910r33790816s49535ca56d7e3c69@mail.gmail.com> On 9/26/06, Suresh V. wrote: > I have a method in y content class that calls getParentNode(). First time I heard of getParentNode. Where does it come from? > What I want is the parent object in the Zope hierarchy. Usually self.context.aq_parent, in a view. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From stefan at epy.co.at Tue Sep 26 18:47:38 2006 From: stefan at epy.co.at (Stefan H. Holek) Date: Tue, 26 Sep 2006 18:47:38 +0200 Subject: [z3-five] getParentNode() returns View class! In-Reply-To: References: Message-ID: <6C45196A-60F9-412E-9349-0029031014D6@epy.co.at> I am quite sure this is a bug, but it has been there forever (since I know Zope) and nobody ever cared enough. getParentNode gives you self.aq_parent which is not (necessarily) the container, but the URL parent. If you want an object's container you have to use self.aq_inner.aq_parent. Stefan On 26. Sep 2006, at 16:59, Suresh V. wrote: > I have a method in y content class that calls getParentNode(). > > def get_output(self): > p = self.getParentNode() > print p.getId() > > When called from a method in the View class: > > context = self.context > context.get_output() > > getParentNode returns the View class and I get: > > AttributeError: getId > > What I want is the parent object in the Zope hierarchy. > > Is this a bug? If not how do I get what I want? > > Suresh -- Anything that, in happening, causes itself to happen again, happens again. --Douglas Adams From suresh_vv at yahoo.com Tue Sep 26 18:43:47 2006 From: suresh_vv at yahoo.com (Suresh V.) Date: Tue, 26 Sep 2006 22:13:47 +0530 Subject: [z3-five] getParentNode() returns View class! In-Reply-To: <319e029f0609260910r33790816s49535ca56d7e3c69@mail.gmail.com> References: <319e029f0609260910r33790816s49535ca56d7e3c69@mail.gmail.com> Message-ID: <451958C3.5000703@yahoo.com> Lennart Regebro wrote: > On 9/26/06, Suresh V. wrote: >> I have a method in y content class that calls getParentNode(). > > First time I heard of getParentNode. Where does it come from? OFS, I think. > >> What I want is the parent object in the Zope hierarchy. > > Usually self.context.aq_parent, in a view. > Nope. This also returns the View class itself. In fact, it looks like the default implementation of getParentNode() is to return aq_parent. Suresh From jim at zope.com Tue Sep 26 20:12:44 2006 From: jim at zope.com (Jim Fulton) Date: Tue, 26 Sep 2006 14:12:44 -0400 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <17689.27338.407071.463678@gargle.gargle.HOWL> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <1DD511CF-6A9F-4281-8054-EA56FBE157DB@zope.com> <4518159A.3070900@simplistix.co.uk> <17689.27338.407071.463678@gargle.gargle.HOWL> Message-ID: On Sep 26, 2006, at 2:00 PM, Dieter Maurer wrote: > Chris Withers wrote at 2006-9-25 18:44 +0100: >> ... >> Can we have a papal edict that zcml that has side effects is a bug? >> (including the dotted name thing...) > > Hm: the purpose of "zcml" is to have side effects (register things, > patch classes with marker interfaces, add permissions, ...) He means during parsing. There is some agreement that the work done by ZCML should be done during the second stage, after conflicts are resolved. Jim -- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From maciej.wisniowski at coig.katowice.pl Tue Sep 26 20:25:14 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Tue, 26 Sep 2006 20:25:14 +0200 Subject: [z3-five] getParentNode() returns View class! In-Reply-To: <451958C3.5000703@yahoo.com> References: <319e029f0609260910r33790816s49535ca56d7e3c69@mail.gmail.com> <451958C3.5000703@yahoo.com> Message-ID: <4519708A.4070904@coig.katowice.pl> >>Usually self.context.aq_parent, in a view. >> >> >> > >Nope. This also returns the View class itself. In fact, it looks like >the default implementation of getParentNode() is to return aq_parent. > > self.context - doesn't this mean that 'aq_parent' of 'context' is 'self'? like: folder1/ folder2/ testscript testscript1 testscript: return context.folder2.testscript.aq_parent >>> testscript1: return context.folder2.folder1.testscript.aq_parent >>> Maybe try self.context.aq_inner.aq_parent ? -- Maciej Wisniowski From maciej.wisniowski at coig.katowice.pl Tue Sep 26 22:59:45 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Tue, 26 Sep 2006 22:59:45 +0200 Subject: [z3-five] getParentNode() returns View class! In-Reply-To: References: Message-ID: <451994C1.3000804@coig.katowice.pl> >What I want is the parent object in the Zope hierarchy. > >Is this a bug? If not how do I get what I want? > > Hmmm... by "Zope hierarchy" you mean 'by containment'? So maybe you want self.context.container or self.context.context. -- Maciej Wisniowski From not.com at gmail.com Wed Sep 27 02:02:38 2006 From: not.com at gmail.com (yary) Date: Tue, 26 Sep 2006 17:02:38 -0700 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <4514FDED.9050209@weitershausen.de> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> <4514769B.1080905@weitershausen.de> <75cbfa570609221755o56cd6a51hacfa3ff36f1008e2@mail.gmail.com> <4514FDED.9050209@weitershausen.de> Message-ID: <75cbfa570609261702h19c4a740l41350b320db688eb@mail.gmail.com> Thanks Philipp, Suresh, and Lennart for your various suggestions. I've installed CalCMF and its dependencies- there was one line which requested CMFOnFive, which is no longer needed, I commented it out. It installs and I can create a personal calendar and view it. I haven't figured out how to add events / meetings to the calendar, but it's not needed for my learning. What it's doing so far is interesting and useable. The serverzen pages ( http://serverzen.net/search?Subject=zope.formlib ) I found earlier, and didn't read at all thoroughly- all the "plones" everywhere scared me away. Taking a longer look, there seems to be no Plone dependencies, other than the zcml glue 'Yup. Zope 2 doesn't yet have the concept of "containers" as it exists in >Zope 3. Aw, shucks, they seem useful. I had my hopes up after doing a "grep -r containerViews" in my Zope 2.9.4 install directory, and finding that string in a few files. Thought I was just using it incorrectly or had to "turn it on". I'm weighing the pros and cons of Zope2+Five vs. Zope3: Zope2 has a mature CMF with good user management and workflow- which I haven't found in Zope3. Zope3 has all the nice clean Zope3 ways of creating custom content objects and integrating them into the framework (ZCML gripes aside- it may not be the best answer to the problem, but it is a working answer, and for that I am grateful). Not that I can pass judgement with any authority, as I'm only browsing the docs and haven't written much yet- other than a few days of work with AT, showing me it wasn't the way to go. From suresh_vv at yahoo.com Wed Sep 27 07:27:48 2006 From: suresh_vv at yahoo.com (Suresh V.) Date: Wed, 27 Sep 2006 10:57:48 +0530 Subject: [z3-five] getParentNode() returns View class! In-Reply-To: <451994C1.3000804@coig.katowice.pl> References: <451994C1.3000804@coig.katowice.pl> Message-ID: Maciej Wisniowski wrote: > Hmmm... by "Zope hierarchy" you mean 'by containment'? > So maybe you want self.context.container or > self.context.context. > Are these attributes defined for all objects? My impression is that they are used only inside a Python Script and not in filesystem code. Suresh From suresh_vv at yahoo.com Wed Sep 27 07:29:39 2006 From: suresh_vv at yahoo.com (Suresh V.) Date: Wed, 27 Sep 2006 10:59:39 +0530 Subject: [z3-five] getParentNode() returns View class! In-Reply-To: <4519708A.4070904@coig.katowice.pl> References: <319e029f0609260910r33790816s49535ca56d7e3c69@mail.gmail.com> <451958C3.5000703@yahoo.com> <4519708A.4070904@coig.katowice.pl> Message-ID: Maciej Wisniowski wrote: > self.context - doesn't this mean that 'aq_parent' of 'context' is 'self'? Yep. And this is true even when self is the View class. And getParentNode always returns aq_parent. That was my revelation for today :) Suresh From regebro at gmail.com Wed Sep 27 07:55:08 2006 From: regebro at gmail.com (Lennart Regebro) Date: Wed, 27 Sep 2006 07:55:08 +0200 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <75cbfa570609261702h19c4a740l41350b320db688eb@mail.gmail.com> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> <4514769B.1080905@weitershausen.de> <75cbfa570609221755o56cd6a51hacfa3ff36f1008e2@mail.gmail.com> <4514FDED.9050209@weitershausen.de> <75cbfa570609261702h19c4a740l41350b320db688eb@mail.gmail.com> Message-ID: <319e029f0609262255x2ea7ed3bif1b2722cc1c3dabd@mail.gmail.com> On 9/27/06, yary wrote: > I've installed CalCMF and its dependencies- there was one line which > requested CMFOnFive, which is no longer needed, I commented it out. It > installs and I can create a personal calendar and view it. I haven't > figured out how to add events / meetings to the calendar By clicking on the actions. Which show up when you install CMFonFive. ;-) -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From maciej.wisniowski at coig.katowice.pl Wed Sep 27 08:49:37 2006 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Wed, 27 Sep 2006 08:49:37 +0200 Subject: [z3-five] getParentNode() returns View class! In-Reply-To: References: <451994C1.3000804@coig.katowice.pl> Message-ID: <451A1F01.1080009@coig.katowice.pl> > Are these attributes defined for all objects? My > impression is that they are used only inside a Python > Script and not in filesystem code. > You're right. Check this: from Acquisition import aq_base, aq_parent, aq_inner class DemoView: """ test view class """ def my_f(self): return 'object: %s' % (aq_base(aq_parent(aq_inner(self.context)))) works for me. -- Maciej Wisniowski From regebro at gmail.com Wed Sep 27 09:04:54 2006 From: regebro at gmail.com (Lennart Regebro) Date: Wed, 27 Sep 2006 09:04:54 +0200 Subject: [z3-five] getParentNode() returns View class! In-Reply-To: References: <451994C1.3000804@coig.katowice.pl> Message-ID: <319e029f0609270004t5b6f8c76m415e6e4dd3f5cd0b@mail.gmail.com> On 9/27/06, Suresh V. wrote: > Are these attributes defined for all objects? ONly for objects that are acquicistion-wrapped. > My > impression is that they are used only inside a Python > Script and not in filesystem code. You can use them in both places, but the methods you often use in filesystem code are safer as they will not fail if you have a non-wrapped object. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From chris at simplistix.co.uk Wed Sep 27 08:49:39 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 27 Sep 2006 07:49:39 +0100 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <17689.27338.407071.463678@gargle.gargle.HOWL> References: <4510F3A6.4030104@simplistix.co.uk> <451106B6.4010609@weitershausen.de> <45123614.5020709@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <1DD511CF-6A9F-4281-8054-EA56FBE157DB@zope.com> <4518159A.3070900@simplistix.co.uk> <17689.27338.407071.463678@gargle.gargle.HOWL> Message-ID: <451A1F03.80705@simplistix.co.uk> Dieter Maurer wrote: > Chris Withers wrote at 2006-9-25 18:44 +0100: >> ... >> Can we have a papal edict that zcml that has side effects is a bug? >> (including the dotted name thing...) > > Hm: the purpose of "zcml" is to have side effects (register things, > patch classes with marker interfaces, add permissions, ...) Yes, but this shouldn't be done at parse time, only at some later "realise" step once _all_ zcml has been parsed. cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From chris at simplistix.co.uk Wed Sep 27 08:43:55 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Wed, 27 Sep 2006 07:43:55 +0100 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <97467318-9017-4A33-81E2-D4A56223F30E@zope.com> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> <451816A2.1050504@simplistix.co.uk> <4518F8C2.1010301@simplistix.co.uk> <97467318-9017-4A33-81E2-D4A56223F30E@zope.com> Message-ID: <451A1DAB.80109@simplistix.co.uk> Jim Fulton wrote: > >> Oh, so some directives have descriminators and others don't? > > Yes. Most do. Soe don't because they don't create actions that > conflict with anything else. Ah, OK. Would it cause any problems to have all actions generate descriminators and only use them for conflict checking for actions that should do so? >> Yep. Would that cover the devmode use case and allow the deprecation >> of the crazy "condition" stuff? ;-) > > I doubt it. Shame... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From jim at zope.com Wed Sep 27 12:17:49 2006 From: jim at zope.com (Jim Fulton) Date: Wed, 27 Sep 2006 06:17:49 -0400 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <451A1DAB.80109@simplistix.co.uk> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> <451816A2.1050504@simplistix.co.uk> <4518F8C2.1010301@simplistix.co.uk> <97467318-9017-4A33-81E2-D4A56223F30E@zope.com> <451A1DAB.80109@simplistix.co.uk> Message-ID: <7D68B3FC-B81E-4231-9225-46DAEF190099@zope.com> On Sep 27, 2006, at 2:43 AM, Chris Withers wrote: > Jim Fulton wrote: >>> Oh, so some directives have descriminators and others don't? >> Yes. Most do. Soe don't because they don't create actions that >> conflict with anything else. > > Ah, OK. Would it cause any problems to have all actions generate > descriminators and only use them for conflict checking for actions > that should do so? That's pretty much what I suggested. The whole point of discriminators was conflict detection. That is why I suggested extending actions to support identifiers that could be used for overriding or disabling even for actions (or groups of actions) that don't otherwise conflict. This id scheme would leverage discriminators when present. Jim -- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From not.com at gmail.com Wed Sep 27 17:48:12 2006 From: not.com at gmail.com (yary) Date: Wed, 27 Sep 2006 08:48:12 -0700 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <319e029f0609262255x2ea7ed3bif1b2722cc1c3dabd@mail.gmail.com> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> <4514769B.1080905@weitershausen.de> <75cbfa570609221755o56cd6a51hacfa3ff36f1008e2@mail.gmail.com> <4514FDED.9050209@weitershausen.de> <75cbfa570609261702h19c4a740l41350b320db688eb@mail.gmail.com> <319e029f0609262255x2ea7ed3bif1b2722cc1c3dabd@mail.gmail.com> Message-ID: <75cbfa570609270848t4a232a26s4fb5cbb4d32c6790@mail.gmail.com> On 26/09/06, Lennart Regebro wrote: .... > By clicking on the actions. Which show up when you install CMFonFive. ;-) Aha, CMFonFive is not obsolete, even with CMF2.0. What confused me this section in its description: "CMFonFive used to have three main parts, but two of these have now been integrated into CMF itself: 1.A set of interface definitions and bridges for many parts of CMF. This part has been moved to CMF itself in CMF 1.5.2. 2.A skin layer that provides integration between the Zope3 standard macros and the CMF main template. This part has been moved to CMF itself in CMF 1.5.2. 3.A Five Actions Tool, that enables you to display the Zope 3 menuItems as CMF actions. Any menuItem registered will be accessible though the portal_actions tool, where the menu the item was registered for will be used as the action category. " vs. "Requirements Zope 2.9.1 or later. CMF 1.5.2 or later. CMF 2.0 does not need CMFonFive." It's a little hard for me to reconcile those- one part saying 2/3rds of CMFonFive is in CMF 1.5.2 and higher, but CMFonFive is needed for CMF1.5.2, even though most of it is already incorporated into 1.5.2. It is not needed for CMF2.0, though it is needed if you want to use the Five Actions tool. From regebro at gmail.com Wed Sep 27 21:21:00 2006 From: regebro at gmail.com (Lennart Regebro) Date: Wed, 27 Sep 2006 21:21:00 +0200 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <75cbfa570609270848t4a232a26s4fb5cbb4d32c6790@mail.gmail.com> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> <4514769B.1080905@weitershausen.de> <75cbfa570609221755o56cd6a51hacfa3ff36f1008e2@mail.gmail.com> <4514FDED.9050209@weitershausen.de> <75cbfa570609261702h19c4a740l41350b320db688eb@mail.gmail.com> <319e029f0609262255x2ea7ed3bif1b2722cc1c3dabd@mail.gmail.com> <75cbfa570609270848t4a232a26s4fb5cbb4d32c6790@mail.gmail.com> Message-ID: <319e029f0609271221h2c7007c9u2e178fd0079645b8@mail.gmail.com> On 9/27/06, yary wrote: > On 26/09/06, Lennart Regebro wrote: > .... > > By clicking on the actions. Which show up when you install CMFonFive. ;-) > > Aha, CMFonFive is not obsolete, even with CMF2.0. What confused me > this section in its description: Oh, you are using CMF2.0. I haven't tried CalCMF with that. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ From chris at simplistix.co.uk Thu Sep 28 10:06:45 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Thu, 28 Sep 2006 09:06:45 +0100 Subject: [z3-five] [Zope3-dev] Re: zcml questions In-Reply-To: <7D68B3FC-B81E-4231-9225-46DAEF190099@zope.com> References: <4510F3A6.4030104@simplistix.co.uk> <451246B0.5090201@weitershausen.de> <45129055.40402@palladion.com> <200609211131.01218.srichter@cosmos.phy.tufts.edu> <76D3B775-3FC9-4563-8EFD-F03C52050F66@zope.com> <451816A2.1050504@simplistix.co.uk> <4518F8C2.1010301@simplistix.co.uk> <97467318-9017-4A33-81E2-D4A56223F30E@zope.com> <451A1DAB.80109@simplistix.co.uk> <7D68B3FC-B81E-4231-9225-46DAEF190099@zope.com> Message-ID: <451B8295.9080807@simplistix.co.uk> Jim Fulton wrote: > > That's pretty much what I suggested. The whole point of discriminators > was conflict detection. That is why I suggested extending actions to > support identifiers that could be used for overriding or disabling even > for actions (or groups of actions) that don't otherwise conflict. This > id scheme would leverage discriminators when present. Sounds cool, I only wish I could offer to help make it happen :-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From d.w.morriss at gmail.com Thu Sep 28 16:56:44 2006 From: d.w.morriss at gmail.com (whit) Date: Thu, 28 Sep 2006 09:56:44 -0500 Subject: [z3-five] A Quick Event-based Cataloging How-to for Zope 2 In-Reply-To: <451949AF.7050005@simplistix.co.uk> References: <451949AF.7050005@simplistix.co.uk> Message-ID: thanks Chris! -w Chris Withers wrote: > Hi All, > > Just been playing with this and found it remarkably easy, so thought I'd > pass it on. If anyone can think of a better place than the mailing list > archives for this, please let me know! > > Anyway, so I'm building a Zope 2 app where I need to index objects that > are not catalog aware when they're added, modified or removed. To make > things harder, this also needs to work via WebDAV. > > OK, so here's the solution: > > 1. Create yourself a python module called subscribers.py and put it on > your python path, containing the following: > > from Acquisition import aq_base > from zope.interface import Interface > > class ICatalogAware(Interface): pass > > def catalog(object,event): > if aq_base(object) is object: > # ObjectModified can get emitted during creation, > # before the object has any acquisition context > return > object.getPhysicalRoot().unrestrictedTraverse( > '/catalog' > ).catalog_object(object) > > def uncatalog(object,event): > object.getPhysicalRoot().unrestrictedTraverse( > '/catalog' > ).uncatalog_object('/'.join(object.getPhysicalPath())) > > 2. Slap the ICatalogAware marker interface on any classes you want to > have indexed. Here's an example for the good old File object. Put the > following in your site.zcml: > > > > > > 3. Finally, wire up the events so that files get indexed when they're > created, modified or removed, again by adding the following to site.zcml: > > handler="subscribers.catalog" > for="ICatalogAware > zope.app.container.contained.ObjectAddedEvent" > /> > > handler="subscribers.catalog" > for="ICatalogAware > zope.app.container.contained.ObjectModifiedEvent" > /> > > handler="subscribers.uncatalog" > for="ICatalogAware > zope.app.container.contained.ObjectRemovedEvent" > /> > > 4. Okay, sadly you do need to get do some patching if you want changes > to the file to result in recataloging :-/ Here's a diff: > > --- Image.py.original 2006-09-26 16:32:20.759375000 +0100 > +++ Image.py 2006-09-26 16:33:11.384375000 +0100 > @@ -33,6 +33,8 @@ > from ZPublisher.HTTPRequest import FileUpload > from ZPublisher.Iterators import filestream_iterator > from zExceptions import Redirect > +from zope.event import notify > +from zope.app.container.contained import ObjectModifiedEvent > from cgi import escape > import transaction > > @@ -437,6 +439,7 @@ > self.ZCacheable_invalidate() > self.ZCacheable_set(None) > self.http__refreshEtag() > + notify(ObjectModifiedEvent(self)) > > def manage_edit(self, title, content_type, precondition='', > filedata=None, REQUEST=None): > > Okay, well, hope this helps someone :-) > > Chris > From not.com at gmail.com Fri Sep 29 00:35:46 2006 From: not.com at gmail.com (yary) Date: Thu, 28 Sep 2006 15:35:46 -0700 Subject: [z3-five] Looking for tutorial/example of Five with CMF, but not Plone In-Reply-To: <319e029f0609271221h2c7007c9u2e178fd0079645b8@mail.gmail.com> References: <75cbfa570609221501x59928991g36b215bafe7d2b87@mail.gmail.com> <4514769B.1080905@weitershausen.de> <75cbfa570609221755o56cd6a51hacfa3ff36f1008e2@mail.gmail.com> <4514FDED.9050209@weitershausen.de> <75cbfa570609261702h19c4a740l41350b320db688eb@mail.gmail.com> <319e029f0609262255x2ea7ed3bif1b2722cc1c3dabd@mail.gmail.com> <75cbfa570609270848t4a232a26s4fb5cbb4d32c6790@mail.gmail.com> <319e029f0609271221h2c7007c9u2e178fd0079645b8@mail.gmail.com> Message-ID: <75cbfa570609281535x39e2499u356cfa4eea8347e2@mail.gmail.com> On 27/09/06, Lennart Regebro wrote: > Oh, you are using CMF2.0. I haven't tried CalCMF with that. I managed to get CalCMF working completely, menu items and all, with CMF 2.0, Five 1.4, and Zope 2.9.4... I had all the pieces days ago but for some reason it only started working when I did it all from scratch in a new instance. Here's the recipe in great detail, for the sake of posterity: make a virgin Zope 294 instance, install CMF 2.0 into Products. Install Five 1.4 and CMFQuickInstallerTool as well, though perhaps not strictly needed. Checkout CalCMF, CalCore, and CalZope from the subversion repository, install them into products. I had to dig around a bit to find CalCore, check out from: svn.nuxeo.org/ pub/Python/CalCore/trunk svn.nuxeo.org/ pub/Zope2/CalCMF/trunk svn.nuxeo.org/ pub/Zope2/CalZope/trunk Install iCalendar by unpacking http://codespeak.net/icalendar/iCalendar-0.11.tgz and running in that build directory "python.exe setup.py install --home /my/zope/instance" Edit CalCMF/Extensions/install.py- on line 80 change 'CMFonFive' to 'CMFCore' Start the Zope instance, in the ZMI create a CMF site - don't add the CMFCalendar! Enter the new CMF portal site you just created, using the management interface, and add a CMFQuickinstaller Tool. Then click on "portal_quickinstaller", check the boxes next to CalCMF and CalZope, and click "Install". View your test instance. Click on the Members folder and create a folder for your admin user, or whomever you are logged in as, if it doesn't already have one (folder id=user name) click "Create my home calendar", in the actions menu across the top. that's it! see your calendar and the object menu items on the left. It still isn't working 100%, I get "AttributeError" "getCurrentUserAttendeeId" when adding an event fro example. But hey, now I can see a working example of how to create custom objects & add menu items to the default menus the "five" way. Not sure why the menu items did not show up the first time I installed it all and ran. Interesting that CalCMF uses both the old and new ways of adding items to menus- using portal_actions.addAction to add the (can't wait for the final release of Zope 2.10, so I can write production code without needing five:traversable!) From chris at simplistix.co.uk Sat Sep 30 00:23:47 2006 From: chris at simplistix.co.uk (Chris Withers) Date: Fri, 29 Sep 2006 23:23:47 +0100 Subject: [z3-five] A Quick Event-based Cataloging How-to for Zope 2 In-Reply-To: References: <451949AF.7050005@simplistix.co.uk> Message-ID: <451D9CF3.4010707@simplistix.co.uk> whit wrote: > thanks Chris! > > -w I just wish there was a good and more permenant place to put this... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk From suresh_vv at yahoo.com Sat Sep 30 08:50:48 2006 From: suresh_vv at yahoo.com (Suresh V.) Date: Sat, 30 Sep 2006 12:20:48 +0530 Subject: [z3-five] A Quick Event-based Cataloging How-to for Zope 2 In-Reply-To: <451D9CF3.4010707@simplistix.co.uk> References: <451949AF.7050005@simplistix.co.uk> <451D9CF3.4010707@simplistix.co.uk> Message-ID: <451E13C8.3020701@yahoo.com> Chris Withers wrote: > whit wrote: >> thanks Chris! >> >> -w > > I just wish there was a good and more permenant place to put this... > Why? When you can just google for Event, Zope2 and Catalog and find this post. Google is your friend. Get used to it! Suresh "Trying to sound like Chris" V. :)