Re: [Zope3-Users] Create and Delete object from command line.
On Oct 6, 2005, at 11:42 PM, Nicolas Legault wrote: 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 ? There are a couple of ways to approach this, depending on your needs. I'm assuming that Zope needs to be serving to other users at the same time, in a more typical client-server role. One approach is to run Zope 3 with ZEO, and write a script that connects to the database via ZEO and modifies the database as you need. This bypasses security, and requires that the script have access to the (sensitive) ZEO port of your Zope. Another approach would be to have a view--XML-RPC, maybe. Have the script make a request with authentication and the necessary information to create your object, then have your view do the work. If I'm not guessing your needs correctly, you'll need to specify a bit more. Gary ___ 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
[Zope3-Users] zcml grants for plugin-auth'ed principals?
Hi all, I'm using an ldap auth source for my principals and have been assigning roles & permissions TTW. This all works great, but I'd really like to manage it in ZCML longer-term. The obvious difficulty I'm having is that my ldap users don't exist at the point where the ZCML is being loaded in. Has anyone devised a work-around for this? TIA for any thoughts, help, or suggestions. Dylan ___ 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=".interfaces.IContentFolder" > type="zope.app.content.interfaces.IContentType" /> > >interface="zope.app.annotation.interfaces.IAttributeAnnotatable" /> >interface="zope.app.container.interfaces.IContentContainer" /> >interface="zope.app.container.interfaces.IAdding" /> > > > > > > > And my 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
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.. 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] Re: Compound Form Elements
Thanks for the tips. > 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 ;-) I've tried making the poll demo as described in widgets.txt to get the hang of this, but unfortunately it doesn't seem to work. When I try to restart zope it give the following error: ZopeXMLConfigurationError: File "C:\Python24\Lib\site-packages\zope\app\demo \poll\configure.zcml", line 5.4-6.47 ConfigurationError: ('Unrecognized parameters:', 'permission') The relevant section of the configure.zcml file reads: Removing the permission section brings up an error further on in the config: ZopeXMLConfigurationError: File "C:\Python24\Lib\site-packages\zope\app\demo \poll\configure.zcml", line 53.4-59.10 ConfigurationError: ('Unrecognized parameters:', 'content_factory') which refers to a section that reads: Removing the content_factory line raises an error along the lines of "must specify either a factory or a class". Changing it to read: class=".poll.Poll" allows Zope to start up, but when I click on the "Poll Demo" add menu item that appears it raises "System Error". From the traceback: Exception Value __init__() takes at least 4 arguments (3 given) (full traceback below) I'm pretty sure I've copied and pasted all the sections of the demo from the widgets.txt file into the right files, but I could have done something else stupid. Or is there something genuinely amiss with the demo? Any thoughts? Thanks, James Traceback (innermost last): * Module zope.publisher.publish, line 138, in publish result = publication.callObject(request, object) * Module zope.app.publication.zopepublication, line 164, in callObject return mapply(ob, request.getPositionalArguments(), request) * Module zope.publisher.publish, line 113, in mapply return debug_call(object, args) __traceback_info__: > * Module zope.publisher.publish, line 119, in debug_call return object(*args) * Module zope.app.container.browser.adding, line 128, in action name=view_name) is not None: * Module zope.component, line 165, in queryMultiAdapter return sitemanager.queryMultiAdapter(objects, interface, name, default) * Module zope.component.site, line 75, in queryMultiAdapter default) * Module zope.interface.adapter, line 481, in queryMultiAdapter return factory(*objects) * Module zope.app.form.browser.editview, line 64, in __init__ self._setUpWidgets() * Module zope.app.form.browser.add, line 49, in _setUpWidgets setUpWidgets(self, self.schema, IInputWidget, names=self.fieldNames) * Module zope.app.form.utility, line 153, in setUpWidgets context=context) * Module zope.app.form.utility, line 101, in setUpWidget widget = widget(field.bind(context), view.request) * Module zope.app.form, line 97, in __call__ instance = self._widget_factory(*args) TypeError: __init__() takes at least 4 arguments (3 given) ___ 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 6, 2005, at 10:54 AM, Gary Poster wrote: Hi Andreas. zc.catalog does. I haven't had time to figure out how to integrate with zope, and to propose its integration, and so on. The specific code is at the very bottom of http://svn.zope.org/ Sandbox/zc/catalog/index.py . Probably should have pointed to the pertinent docs too :-P http://svn.zope.org/Sandbox/zc/catalog/normalizedindex.txt?&view=auto Gary ___ 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 6, 2005, at 10:11 AM, Andreas Jung wrote: --On 6. Oktober 2005 09:55:55 -0400 Gary Poster <[EMAIL PROTECTED]> wrote: 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/ Do we already have a datetime index? Uwe Östermeier asked at the sprint today about an implementation. Hi Andreas. zc.catalog does. I haven't had time to figure out how to integrate with zope, and to propose its integration, and so on. The specific code is at the very bottom of http://svn.zope.org/ Sandbox/zc/catalog/index.py . Gary ___ 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] Problem: "Could not locate Zope software installation!"
Ronald L Chichester wrote: This, of course, begs the question of some 64-bit compatibility issue. That is a possibility, but we do have a 64-bit Athalon running here used in daily development with no problems (running Ubuntu). -- Benji York Senior Software Engineer Zope Corporation ___ 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
Oh yeah, I do remember that issue on OS X. It was easily worked around on OS X. I'll check that out on HP-UX. --- 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! for Good Donate to the Hurricane Katrina relief effort. http://store.yahoo.com/redcross-donate3/ ___ 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 6. Oktober 2005 09:55:55 -0400 Gary Poster <[EMAIL PROTECTED]> wrote: 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/ Do we already have a datetime index? Uwe Östermeier asked at the sprint today about an implementation. Andreas pgpurV3an8DQK.pgp Description: PGP signature ___ 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!"
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] 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] 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 = _(u"Show Data?")) type = TextLine(title = _(u"Data Type")) value = TextLine(title = _(u"Data Value")) # main schema class IUser(Interface) name_first = TextLine( title = _(u"First Name") ) name_last = TextLine( title = _(u"Last Name") ) contact_info = List( title = _(u"Contact 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: 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
[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
[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=u"Contact Details", ... value_type=Dict( ... title=u"dictionary", ... value_type=Bool(title=u"show") ... value_type=TextLine(title=u"value") ... value_type=TextLine(title=u"type") ... ) ... ) 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