From derek.richardson at gatech.edu Tue Jul 10 20:47:36 2007 From: derek.richardson at gatech.edu (Derek Richardson) Date: Tue, 10 Jul 2007 14:47:36 -0400 Subject: [z3-five] zcml not being loaded in buildout for Vice Message-ID: The buildout at http://dev.plone.org/plone/browser/review/vice seems to work fine. I can svn co https://svn.plone.org/svn/plone/review/vice cd vice python bootstrap.py bin/buildout bin/instance test -m plone.syndication.outbound The tests fail, but that's mostly expected. The problem is that the third test fails because it can't find an adapter. The test should fail for another reason, further down the line. It can't find the adapter because: plone.syndication.outbound/plone/syndication/outbound/configure.zcml is not being loaded. Funny thing is, the zcml loads fine when I do it directly in Zope 2.10.4, manually adding Plone 3b3 and the Vice packages without a buildout. It also loads when I do a bin/instance fg I've inspected the namespace packages' __init__.py files. I've looked at the buildout zcml configuration. And I've inspected the dev-eggs to make sure they look ok. Anyone have any ideas? Thanks. From optilude at gmx.net Tue Jul 10 20:55:05 2007 From: optilude at gmx.net (Martin Aspeli) Date: Tue, 10 Jul 2007 19:55:05 +0100 Subject: [z3-five] zcml not being loaded in buildout for Vice In-Reply-To: References: Message-ID: Derek Richardson wrote: > The buildout at http://dev.plone.org/plone/browser/review/vice seems to > work fine. I can > > svn co https://svn.plone.org/svn/plone/review/vice > cd vice > python bootstrap.py > bin/buildout > bin/instance test -m plone.syndication.outbound > > The tests fail, but that's mostly expected. The problem is that the > third test fails because it can't find an adapter. The test should fail > for another reason, further down the line. > > It can't find the adapter because: > > plone.syndication.outbound/plone/syndication/outbound/configure.zcml > > is not being loaded. > > Funny thing is, the zcml loads fine when I do it directly in Zope > 2.10.4, manually adding Plone 3b3 and the Vice packages without a buildout. > > It also loads when I do a > > bin/instance fg > > I've inspected the namespace packages' __init__.py files. I've looked at > the buildout zcml configuration. And I've inspected the dev-eggs to make > sure they look ok. Anyone have any ideas? You need to either have a ZCML slug or (better) load the ZCML directly using a layer or as part of your test setup. See: http://dev.plone.org/collective/browser/borg/components/borg.project/trunk/borg/project/tests.py The installProduct thing is only necessary if this is has five:registerPackage on it. Martin -- Acquisition is a jealous mistress From cklinger at novareto.de Wed Jul 11 10:45:51 2007 From: cklinger at novareto.de (Christian Klinger) Date: Wed, 11 Jul 2007 10:45:51 +0200 Subject: [z3-five] Rendering Values in an MulitCheckBoxWidget Message-ID: Hi, i try to render a customized MultiCheckBoxWidget. The add-form works fine. But if i try to render the edit-form the values that i turned on in the add form are not selected in the edit-form. This is my Widget: ----------------------------------------------------------------------- from zope.app.form.browser import MultiCheckBoxWidget class MultiCheckBoxVocabularyWidget(MultiCheckBoxWidget): """ """ def __init__(self, field, request): """Initialize the widget.""" super(MultiCheckBoxVocabularyWidget, self).__init__(field, field.value_type.vocabulary, request) ----------------------------------------------------------------------- This is my formlib editform: ----------------------------------------------------------------------- class ExtranetMembershipUpdateUser(formbase.PageAddForm): """ ExtranetMembership Add Form """ implements(IExtranetMembershipUser) form_fields['berechtigung'].custom_widget = MultiCheckBoxVocabularyWidget def setUpWidgets(self, ignore_request=False): user['berechtigung']=['Value'] self.widgets = form.setUpWidgets( self.form_fields, self.prefix, self.context, self.request, ignore_request=ignore_request, data=user) ------------------------------------------------------------------------ Maybe someone of you had an idea. Thx christian From k_vertigo at objectrealms.net Fri Jul 13 22:27:09 2007 From: k_vertigo at objectrealms.net (Kapil Thangavelu) Date: Fri, 13 Jul 2007 16:27:09 -0400 Subject: [z3-five] enabling submenuitems Message-ID: hi folks, i was playing around with submenuitems recently, and ran into the issue that five's browser meta.zcml doesn't support it. its a fairly trivial fix to to enable it. if i put together a unit test for the functionality, would anyone object to me adding this to Five 1.4, Five 1.5 branches, and the trunk? cheers, kapil fwiw the diff is Index: browser/meta.zcml =================================================================== --- browser/meta.zcml (revision 77691) +++ browser/meta.zcml (working copy) @@ -23,6 +23,11 @@ schema="zope.app.publisher.browser.metadirectives.IMenuItemSubdirective" /> + + Hi Is this still necessary to use five:traversable directive to enable views lookup in Zope 2.10? Seems to me that everything works without this directive but I'd like to be sure... -- Maciej Wisniowski From lists at zopyx.com Wed Jul 25 07:57:27 2007 From: lists at zopyx.com (Andreas Jung) Date: Wed, 25 Jul 2007 07:57:27 +0200 Subject: [z3-five] Is five:traversable necessary in Zope 2.10? In-Reply-To: <46A6E457.1070805@coig.katowice.pl> References: <46A6E457.1070805@coig.katowice.pl> Message-ID: <32ADFCCDA993F647C8699598@suxmac2.local> --On 25. Juli 2007 07:49:11 +0200 Maciej Wisniowski wrote: > Hi > > Is this still necessary to use five:traversable > directive to enable views lookup in Zope 2.10? The release notes tell you: no -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/20070725/f1c663e4/attachment.pgp From maciej.wisniowski at coig.katowice.pl Wed Jul 25 08:28:09 2007 From: maciej.wisniowski at coig.katowice.pl (Maciej Wisniowski) Date: Wed, 25 Jul 2007 08:28:09 +0200 Subject: [z3-five] Is five:traversable necessary in Zope 2.10? In-Reply-To: <32ADFCCDA993F647C8699598@suxmac2.local> References: <46A6E457.1070805@coig.katowice.pl> <32ADFCCDA993F647C8699598@suxmac2.local> Message-ID: <46A6ED79.9030201@coig.katowice.pl> >> Is this still necessary to use five:traversable >> directive to enable views lookup in Zope 2.10? > > The release notes tell you: no I've missed that. Thanks! -- Maciej Wisniowski From pw_lists at slinkp.com Fri Sep 21 23:47:13 2007 From: pw_lists at slinkp.com (Paul Winkler) Date: Fri, 21 Sep 2007 17:47:13 -0400 Subject: [z3-five] Traversal with methods other than GET or POST Message-ID: <20070921214713.GA8243@slinkp.com> Hi folks, I've been playing with a toy REST service implemented in Five (tried it with both zope 2.9 and 2.10) and wanted to warn people of an annoying stumbling block that I wasted a lot of time on. I don't blog so this seemed like a good place to post it. When I'm prototyping an app that doesn't use the ZODB for persistence, I have a habit of hanging views directly on OFS.Application; sometimes this is even good enough for my finished product. For example: Now we can visit http://example:8080/myview. It's possible to handle traversal from there by implementing a custom traverser (ITraverser for zope 2.9, IPublishTraverse for 2.10) and registering it on the above view, like so: Now we can traverse http://example:8080/myview/foo/bar/... But here's the gotcha. None of this works if the request method is not GET or POST. Why? Because we're starting traversal at OFS.Application.Application. Its __bobo_traverse__() does something odd: if no attribute with the correct name is found, it checks the HTTP verb. If the verb is anything other than 'GET' or 'POST', it returns an instance of webdav.NullResource.NullResource. Presumably this makes sense for Zope 2's semi-automagic support of WebDAV. But it's not nice in the Five world, where Five views only get looked up if __bobo_traverse__() raises an error or is not defined. The code path that ZPublisher follows is different between 2.9 and 2.10, but the result in both is the same: once the NullResource gets into the picture, traversal is done and your Five views are never looked up. So if you're working on a REST application and, like me, stupidly trying to beging traversal at the Zope app root, you're out of luck :-) Possible solution: Create a simple custom persistent object which implements just enough traversal magic to get Zope to use your custom traversal class: class StupidTraversalRoot(SimpleItem): ... def __bobo_traverse__(self, request, name): raise AttributeError (Or I suppose it could inherit from Persistent but not Traversable, either way should work.) Then create an instance of this in Zope and use it as the place to hang our views. This should prevent the unwanted NullResource object from mucking things up. By the way, here's the basic idea of how I handle HTTP verbs. I have a base class for my views that consists of little more than this: def __call__(self): response = self.request.response verb = self.request.get('REQUEST_METHOD') method = getattr(self, verb, None) if method == None: # Not implemented. response.setStatus(405) return "helpful error message" return method() Verbs can then be implemented by subclasses, like so: def PUT(self): """create a child resource""" ... An alternative approach can be seen in Schooltool, where views are associated with verbs via zcml. See eg. http://source.schooltool.org/viewcvs/trunk/schooltool/src/schooltool/app/rest/configure.zcml?rev=6558&view=markup -- Paul Winkler http://www.slinkp.com