[Zope3-Users] Re: Compound Form Elements
On 04/10/05, James Allwyn [EMAIL PROTECTED] wrote: Hello, I wish my users to be able to register various contact details. For each, I would record the type (e.g. email, landline tel, mobile tel, fax...), the value (e.g. [EMAIL PROTECTED]) and a True/False value on whether it is to be visible on the site. Thinking further about this, it seems to me that the natural data structure would be dicts within a list. For example, if were doing it in plain python it might go something like this: contacts = [] contacts [] contact1 = {show:True, type:mobile tel, value: 07123 456 789} contact2 = {show:False, type:email, value: [EMAIL PROTECTED]} contact1['type'] 'mobile tel' contact2['type'] 'email' contacts.append(contact1) contacts.append(contact2) contacts [{'type': 'mobile tel', 'value': '07123 456 789', 'show': True}, {'type': 'email ', 'value': '[EMAIL PROTECTED]', 'show': False}] len(contacts) 2 I've tried to implement this zopeishly, and the stumbling block I've hit seems to be specifying the key and value_type pairs in the dict. So, for example: from zope.interface import Interface from zope.schema import List, Dict, Bool, TextLine class IUser(Interface): ... contacts = List( ... title=uContact Details, ... value_type=Dict( ... title=udictionary, ... value_type=Bool(title=ushow) ... value_type=TextLine(title=uvalue) ... value_type=TextLine(title=utype) ... ) ... ) This barfs when it hits the second value_type in the dict. Look at the zope.schema sources it seems I can only specify one value_type and one key_type. What I want to do is specify three pairs of keys and value_types - note, specifying the actual keys, not just their types. Is this possible? Or am I barking up the wrong tree!? Any hints gratefully received. Thanks, James This seems to me to add up to an amalgamation of one each of Choice, TextLine and Bool Schema elements. Should I build up a custom Schema item that combines these three things, or would anyone recommend an alternative route? It would be nice if I could combine this with a bit of checking for validity of the value (obviously based on the type selected). From a visual perspective, Schema based forms seem to stack each schema element up on a new line. To make better use of screen 'real estate' (and to logically group) I think it would be better if my amalgamation appeared on one line. Does this have any baring on how I should approach the issue? Alternatively, I'd be open to any suggestions on completely different ways of handling this - the 'custom schema element' way does have the problem that if I wanted to allow up to, say, six contact details to be provided I would have to put six sets of three control elements on screen, which would be wasteful for users who only want to specify one contact detail. Thanks, James ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] New mailinglist for Zope 3 translators
Hello all, [Sorry for the cross-post, please CC replies to [EMAIL PROTECTED] only.] two months ago, I started an initiative [1] to translate Zope 3.1 using Ubuntu's Launchpad system [2]. Since then, I've received a lot of emails from numerous volunteers around the world and many of them made some excellent progress [3]. Thanks to everyone who contributed so far. A new mailinglist at [EMAIL PROTECTED] will now help translators and developers like me to coordinate their work. For example, all those translations will have to be integrated back into the Zope 3.1 repository at some point which has to be coordinated somehow. Also, translators themselves will want to coordinate the work among them. The mailinglist will serve as a forum for discussing and coordinating things like that. So, if you're involved into Zope 3 translations OR if you would like to contribute something to Zope 3 by helping to translate it into your language, please subscribe to the new list [4]. If you have any questions, feel free to email me or even better the new list. Best regards Philipp [1] http://mail.zope.org/pipermail/zope3-dev/2005-August/015113.html [2] https://launchpad.net [3] https://launchpad.net/products/zope/+series/zope3.1/+pots/zope [4] http://mail.zope.org/mailman/listinfo/zope3-i18n ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Compound Form Elements
On Oct 6, 2005, at 2:29 AM, James Allwyn wrote: On 04/10/05, James Allwyn [EMAIL PROTECTED] wrote: Hello, I wish my users to be able to register various contact details. For each, I would record the type (e.g. email, landline tel, mobile tel, fax...), the value (e.g. [EMAIL PROTECTED]) and a True/False value on whether it is to be visible on the site. I've tried to implement this zopeishly, and the stumbling block I've hit seems to be specifying the key and value_type pairs in the dict. So, for example: [snip] This barfs when it hits the second value_type in the dict. Look at the zope.schema sources it seems I can only specify one value_type and one key_type. What I want to do is specify three pairs of keys and value_types - note, specifying the actual keys, not just their types. Is this possible? Or am I barking up the wrong tree!? Any hints gratefully received. Hey James, What you probably want to explore is the Object field. This lets you define a sub-schema, as it were, and use that in your main schema. An example (untested)... maybe in yourproject/types/interfaces.py: from zope.interface import Interface from zope.schema import List, Text, TextLine, Int, Choice from zope.schema import Object from zope.i18nmessageid import MessageIDFactory _ = MessageIDFactory('yourproj') # sub-schema class IContactData(Interface): show = Bool(title = _(uShow Data?)) type = TextLine(title = _(uData Type)) value = TextLine(title = _(uData Value)) # main schema class IUser(Interface) name_first = TextLine( title = _(uFirst Name) ) name_last = TextLine( title = _(uLast Name) ) contact_info = List( title = _(uContact Info), value_type = Object( schema=IContactData, ), ) Then (maybe in user.py, ): ... class ContactData(object): implements(IPageSection) # and whatever else you might want to # put in here class User(PortalContent): implements(IUser) # and whatever else you might want to # put in here ... Then you're going to have to do some extra work with a custom widget (a good place would be ./browser/userview.py): from zope.app.form.browser import ObjectWidget from zope.app.form.browser.editview import EditView from zope.app.form import CustomWidgetFactory from yourproject.types import ContactData from yourproject.types.interfaces import IUser parts_w = CustomWidgetFactory(ObjectWidget, ContactData) class ContactDataEditView(EditView): View for editing a page section. __used_for__ = IUser parts_widget = parts_w In your browser/configure.zcml, your going to need something like this: browser:editform schema=yourproject.types.interfaces.IUser class=.userview.ContactDataEditView label=Edit User name=edit.html menu=zmi_views title=Edit permission=zope.ManageContent / I may be forgetting something here... but this should certainly give you a head start. There's a bunch of very good information on this in these files: zope/app/form/browser/widgets.txt zope/app/form/browser/objectwidget.txt Hmmm, looking through these again, these are really good examples. Pay more attention to them than to what I wrote above ;-) By the way, (and irrespective of the structure of the data) this data you are adding seems to me a good candidate for annotations. You might want to explore that... Happy trails! d ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem: Could not locate Zope software installation!
Ronald L Chichester wrote: I downloaded ZopeX3-3.0.1 and Zope3.1 (final). The ./configure | make | make install (as root) went without a hitch. However, when I went to make an instance (with either 3.0.1 or 3.1) I got a Could not locate Zope software installation! In both cases, I used the default settings (i.e., Zope was made in /usr/local/Zopex/ I used /usr/local/ZopeX3x/bin/mkzopeinstance -u manager:secret ... and got the error message. I've seen this before in the bug track list, but has anyone got a workaround? I'm using Zope on Gentoo Linux (2.6.13-r2 kernel) with python 2.3.5 and and GCC 3.4.4. Just a guess. Do you have net-zope/zopeinterface installed? It provides a package named zope in /usr/lib/[system python]/site-packages. This might make weird namespace issues. -Jim Washington ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem: Could not locate Zope software installation!
On Thu, 06 Oct 2005 07:22:28 -0400 Jim Washington [EMAIL PROTECTED] wrote: Ronald L Chichester wrote: I downloaded ZopeX3-3.0.1 and Zope3.1 (final). The ./configure | make | make install (as root) went without a hitch. However, when I went to make an instance (with either 3.0.1 or 3.1) I got a Could not locate Zope software installation! In both cases, I used the default settings (i.e., Zope was made in /usr/local/Zopex/ I used /usr/local/ZopeX3x/bin/mkzopeinstance -u manager:secret ... and got the error message. I've seen this before in the bug track list, but has anyone got a workaround? I'm using Zope on Gentoo Linux (2.6.13-r2 kernel) with python 2.3.5 and and GCC 3.4.4. Just a guess. Do you have net-zope/zopeinterface installed? It provides a package named zope in /usr/lib/[system python]/site-packages. This might make weird namespace issues. Nope. Not this time. For one, I've had notoriously bad luck with that application (I prefer to install from source myself). Secondly, the package that you mentioned is masked for my architecture (~amd64). Good thought, though. Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] searching content objects on created datetime
On Oct 5, 2005, at 9:00 PM, Alen Stanisic wrote: Hi, I am trying to search my content objects on their creation datetime. For example, a user can enter From and To dates and I would like to retrieve all content objects based on the date range. Hi Alen. Take a look at zc.catalog in the sandbox. It has some code to specifically do what you want (assuming I understand it). http:// svn.zope.org/Sandbox/zc/catalog/ Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem: Could not locate Zope software installation!
FYI: I just downloaded and installed Zope 3.1 on another Gentoo box (with the same /etc/profile as the one depicted below). That (second) one worked without any issues whatsoever. The major differences between the two boxes is that the first box is using an Athlon64 chip (with Gentoo's amd64 installation), and the second box is an older Pentium III (using Gentoo's x86 installation). This, of course, begs the question of some 64-bit compatibility issue. I noticed that when it builds (using make) that a --skip-build parameter is included. Could the lack of that particular building be a problem? Ron On Thu, 06 Oct 2005 08:47:49 -0500 Ronald L Chichester [EMAIL PROTECTED] wrote: On Thu, 06 Oct 2005 07:22:28 -0400 Jim Washington [EMAIL PROTECTED] wrote: Ronald L Chichester wrote: I downloaded ZopeX3-3.0.1 and Zope3.1 (final). The ./configure | make | make install (as root) went without a hitch. However, when I went to make an instance (with either 3.0.1 or 3.1) I got a Could not locate Zope software installation! In both cases, I used the default settings (i.e., Zope was made in /usr/local/Zopex/ I used /usr/local/ZopeX3x/bin/mkzopeinstance -u manager:secret ... and got the error message. I've seen this before in the bug track list, but has anyone got a workaround? I'm using Zope on Gentoo Linux (2.6.13-r2 kernel) with python 2.3.5 and and GCC 3.4.4. Just a guess. Do you have net-zope/zopeinterface installed? It provides a package named zope in /usr/lib/[system python]/site-packages. This might make weird namespace issues. Nope. Not this time. For one, I've had notoriously bad luck with that application (I prefer to install from source myself). Secondly, the package that you mentioned is masked for my architecture (~amd64). Good thought, though. Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] bug on HP-UX 11.00
Stack size doesn't seem to be the issue. The HP box is set to 31116 Kb. The recommendation on early releases of Mac OS X was 4096 Kb. Good idea though! Does anyone have any ideas on why the unittest would fail? Specifically, the testLargeBody method in test_httpserver.py? it calls a method loop: def loop(self): self.thread_started.set() while self.run_loop: self.counter = self.counter + 1 #print 'loop', self.counter poll(0.1) which loops forever. Why would this happen on HP-UX and not on other systems? I'm not to familiar with socket programming and the poll() call. Is there some peculiarity with the underlying poll() and select() calls on HP-UX that I have to make adjustments for? I really appreciate any tips or insight! --- Chris McDonough [EMAIL PROTECTED] wrote: I don't know much about HPUX, but one issue that seems to plague a lot of less-frequently-used platforms is stack sizes. For example, for a while in FreeBSD and on MacOS, you needed to explicitly bump up the thread stack size. See doc/PLATFORMS/BSD.txt in the Zope release for an idea about how to do this. - C On Oct 5, 2005, at 10:08 AM, Chris Leonello wrote: I have been successfully running for many months on Windows XP and Mac OS X. I cannot get the server to run on HP-UX, however. I can build and install o.k., but when I visit http://127.0.0.1:8080/ in the browser, the process either hangs (built under python 2.3.5) or terminates with a bus error (built under python 2.4.1 or 2.4.2). In any case, the (verbose) output from the runzope process looks like this: -- 2005-10-03T17:34:31 WARNING ZODB.FileStorage Ignoring index for /ford/et17112/u/cleonell/cusr/local/zopehome/var/Data.fs -- 2005-10-03T17:34:31 INFO PublisherHTTPServer zope.server.http (HTTP) started. Hostname: et17112 Port: 8080 -- 2005-10-03T17:34:31 INFO PublisherFTPServer zope.server.ftp started. Hostname: et17112 Port: 8021 -- 2005-10-03T17:34:31 INFO root Startup time: 20.685 sec real, 12.460 sec CPU # /ford/et17112/u/cleonell/cusr/local/Zope-3.1.0/lib/python/zope/i18n/ locales/xmlfactory.pyc matches /ford/et17112/u/cleonell/cusr/local/Zope-3.1.0/lib/python/zope/i18n/ locales/xmlfactory.py import zope.i18n.locales.xmlfactory # precompiled from /ford/et17112/u/cleonell/cusr/local/Zope-3.1.0/lib/python/zope/i18n/ locales/xmlfactory.pyc # /ford/et17112/u/cleonell/cusr/local/lib/python2.3/xml/dom/ expatbuilder.pyc matches /ford/et17112/u/cleonell/cusr/local/lib/python2.3/xml/dom/ expatbuilder.py import xml.dom.expatbuilder # precompiled from /ford/et17112/u/cleonell/cusr/local/lib/python2.3/xml/dom/ expatbuilder.pyc Terminated (If I killed process or Bus Error under python 2.4.1/.2) I don't know if the initial warning is significant or not. I don't know if this is related or not, but the test suite (compiled under python 2.3.5) hangs on testLargeBody: 6692/6990 ( 95.7%): testChunkingRequestWithoutContent (zope.server.http.tests.test_httpserver.Tests) ... ok 6693/6990 ( 95.8%): testEchoResponse (zope.server.http.tests.test_httpserver.Tests) ... ok 6694/6990 ( 95.8%): testLargeBody (zope.server.http.tests.test_httpserver.Tests) ... It gets caught in an infinite loop in the loop method (I killed it after 55,000 iterations). Any help or feedback is appreciated. Thanks! Chris Leonello [EMAIL PROTECTED] __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users Chris Leonello [EMAIL PROTECTED] __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] bug on HP-UX 11.00
On 10/6/05, Chris Leonello [EMAIL PROTECTED] wrote: Stack size doesn't seem to be the issue. The HP box is set to 31116 Kb. The recommendation on early releases of Mac OS X was 4096 Kb. Good idea though! Does anyone have any ideas on why the unittest would fail? Specifically, the testLargeBody method in test_httpserver.py? it calls a method loop: def loop(self): self.thread_started.set() while self.run_loop: self.counter = self.counter + 1 #print 'loop', self.counter poll(0.1) which loops forever. Why would this happen on HP-UX and not on other systems? I'm not to familiar with socket programming and the poll() call. Is there some peculiarity with the underlying poll() and select() calls on HP-UX that I have to make adjustments for? I really appreciate any tips or insight! Where did you get the python you are using on HP-UX from? Did you build it yourself? I believe you also said you were using python 2.3.something. Does Zope 3 require python 2.4? Also, how current is your system on HP-UX quality pack bundles? You said you are running 11.0, which while supported, is a bit long in the tooth. Jeff D (newbie list subscriber, trying to learn about Zope 3) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] addview name not form
Am Montag, 3. Oktober 2005 14:01 schrieb Florian Lindner: Am Freitag, 30. September 2005 20:17 schrieb Julien Anguenot: Florian Lindner wrote: Am Donnerstag, 29. September 2005 20:25 schrieb Julien Anguenot: First have a look at this : http://www.zope.org/Collectors/Zope3-dev/391 Sorry, didn't read that thoroughly. What do you suggest at the moment do get the desired behavior? Your ContentFolder should implement IAdding and then your example should work I guess. I've modified my content class directive for the addfolder: interface interface=.interfaces.IContentFolder type=zope.app.content.interfaces.IContentType / content class=.contentfolder.ContentFolder implements interface=zope.app.annotation.interfaces.IAttributeAnnotatable / implements interface=zope.app.container.interfaces.IContentContainer / implements interface=zope.app.container.interfaces.IAdding / factory description=CS ContentFolder / require permission=CS.View interface=.interfaces.IContentFolder / require permission=CS.Edit set_schema=.interfaces.IContentFolder / /content And my addMenuItem: addMenuItem title=Link class=CS.Link.link.Link view=AddCSLink.html permission=CS.Add menu=CSaddMenu layer=centershock for=CS.ContentFolder.interfaces.IContentFolder / it's still: zope.configuration.exceptions.ConfigurationError: view name AddCSLink.html not found Does it work with your code? (the code I uploaded) Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Create and Delete object from command line.
I need to create object in Zope3 like clicking in the Add section and filling the Add form via a python script that will be called from the command line. This script will add many or remove instance of different object in Zope3 Up to day I've not come to understand a way to do this. Is there any information about a way to do this ? Nicolas Legault Immo-Controle Inc. 514-272-3453 Ext 2 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users