[Zope3-Users] Cloning interfaces/interface fields - how?
Hi, I'm over and over confronted with a simple pattern, where I need to clone interface field. For instance, I have the content object, which has an interface, e.g.: class IPerson(Interface): name = TextLine() address = TextLine() Then, I have for instance a search form, which consists of fields of other interfaces, therefore I tried this: class IPersonSearch(Interface): name = IPerson['name'] The above interface has the problem that the field is referenced, thus changing attributes (e.g. name.required=False) changes also the attributes of the original field. Therefore I now copy the field, which seems to work (but I'm not 100% certain): class IPersonSearch(Interface): name = copy.deepcopy(IPerson['name']) Another idea is to entirley skip the IPersonSearch interface and create the interface on the fly, like this: class SearchFrom(z3c.form.EditForm): fields = z3c.form.field.Fields(copy.deepcopy(IPerson).select('name')) However, this does not seem to work as still some things are referenced instead of copied, so copy.deepcopy seems to fail on interfaces. What's your opinion on this, how do you apply this pattern? Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] How do you develop in zope 3?
Hello, * How do you develop in zope 3? First a few words: After trying from time to time Zope 3 (X3, 3.0...) finally a month ago I jumped in full time. Thanks to Philipp von Weitershausen's book, my previous problems were solved. So I downloaded the zope 3 tar.gz and started to practice... only to discover eggs, buildouts, paster and friends (yes, pretty much I've been living under a programmer's rock). Well, no problem. After reading http://pypi.python.org/pypi/zopeproject/ and http://pypi.python.org/pypi/zc.buildout I was on track again. So basically, what I do is: # Create a virtual environment $ python2.4 bin/virtual-python.py --prefix=~/zope3/ # install easy_setup $ ~/zope3/bin/python bin/ez_setup.py # Install zopeproject (of course, all these steps are made just once) $ ~/zope/bin/easy_install zopeproject # make the projects $ ~/zope/bin/zopeproject webdev and then edit setup.py, buildout.cfg. and work in src/webdev. So long, so fine. But here come my doubts: *) Is it the way the experienced zope developers work? How do you set the environment for a site or a package development? *) I'm working in more than a package. I'm developing a blog, a user manager, etc. Should I create a new project for each package? How do I include in my site (under development) my packages (under development)? *) What recipe do you use to fetch a package via svn? Thanks in advance Thanks in advance ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: How do you develop in zope 3?
Gidday I am very interested to read some replies to this. I'm in much the same situation and very confused now. On 20/02/2008, at 4:00 AM, [EMAIL PROTECTED] wrote: How do you develop in zope 3? First a few words: After trying from time to time Zope 3 (X3, 3.0...) finally a month ago I jumped in full time. Thanks to Philipp von Weitershausen's book, my previous problems were solved. So I downloaded the zope 3 tar.gz and started to practice... only to discover eggs, buildouts, paster and friends (yes, pretty much I've been living under a programmer's rock). Well, no problem. After reading http://pypi.python.org/pypi/ zopeproject/ and http://pypi.python.org/pypi/zc.buildout I was on track again. So basically, what I do is: # Create a virtual environment $ python2.4 bin/virtual-python.py --prefix=~/zope3/ # install easy_setup $ ~/zope3/bin/python bin/ez_setup.py # Install zopeproject (of course, all these steps are made just once) $ ~/zope/bin/easy_install zopeproject # make the projects $ ~/zope/bin/zopeproject webdev and then edit setup.py, buildout.cfg. and work in src/webdev. So long, so fine. But here come my doubts: *) Is it the way the experienced zope developers work? How do you set the environment for a site or a package development? *) I'm working in more than a package. I'm developing a blog, a user manager, etc. Should I create a new project for each package? How do I include in my site (under development) my packages (under development)? *) What recipe do you use to fetch a package via svn? George Wright http://www.labyrinth.net.au/~gwright ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] if make check(test) failure, should I make install?
What to do next? If the make test results: -- Ran 9471 tests with 4 failures and 9 errors in 12 minutes 31.391 seconds. Tests with errors: testInheritanceAcrossModules (zodbcode.tests.test_class.TestClass) testPersistentSubclass (zodbcode.tests.test_class.TestClass) testSavePersistentSubclass (zodbcode.tests.test_class.TestClass) testClass (zodbcode.tests.test_module.TestModule) testUpdateClass (zodbcode.tests.test_module.TestModule) testClassReload (zodbcode.tests.test_module.TestModuleReload) testAPPE (zope.server.ftp.tests.test_ftpserver.Tests) testSTOR (zope.server.ftp.tests.test_ftpserver.Tests) testSTOR_over (zope.server.ftp.tests.test_ftpserver.Tests) Tests with failures: checkOldStyleRoot (ZODB.tests.testPersistentMapping.PMTests) testPatch (zodbcode.tests.test_patch.TestPatch) testPASS (zope.server.ftp.tests.test_ftpserver.Tests) /root/zope3/Zope-3.4.0c1/build/lib.linux-i686-2.4/zope/testing/testrunner-layers-ntd.txt -- Appreciate any suggestions. Singuan Iap___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Cloning interfaces/interface fields - how?
Am Dienstag, 19. Februar 2008 20:13 schrieb Marius Gedminas: On Tue, Feb 19, 2008 at 04:46:29PM +0100, Hermann Himmelbauer wrote: class SearchFrom(z3c.form.EditForm): fields = z3c.form.field.Fields(copy.deepcopy(IPerson).select('name')) Strike out the deepcopy and you've got the correct solution: class SearchFrom(z3c.form.EditForm): fields = z3c.form.field.Fields(IPerson).select('name') However, this does not seem to work as still some things are referenced instead of copied, so copy.deepcopy seems to fail on interfaces. What are you trying to achieve? Zope 3 schema fields ought to be treated as immutable objects. What's your opinion on this, how do you apply this pattern? We don't modify fields, ever. We use the power of zope.formlib (or z3c.form) to get dynamic forms. Yes, I also use z3c.form, but my problem is that the field has the required flag set to True, which is appropriate for an add/edit form but may not be appropriate for a search form. If I change the required flag on the field level, e.g. in the update() method, the change is permanent in the interface, which is not appropriate. And changing it on the widget level seems to be very complicated, at least, I found no way to do it. Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How do you develop in zope 3?
Am Dienstag, 19. Februar 2008 16:22 schrieb [EMAIL PROTECTED]: Hello, * How do you develop in zope 3? *) Is it the way the experienced zope developers work? How do you set the environment for a site or a package development? I personally do it the old fashioned way: I downloaded the tarball, decompressed it and created a zope instance. This has some advantages, e.g. you have the Zope source code (which you urgently need to do Zope3 development), you can put multiple applications on one instance and it's very simple to install (untar, make install, create instance). I still have no deployment schema for my application, though, which is a major drawback. *) I'm working in more than a package. I'm developing a blog, a user manager, etc. Should I create a new project for each package? How do I include in my site (under development) my packages (under development)? Good question - I don't use zopeproject, but I'd recommend to split up your packages if it is possible. This way, you may easily reuse packages in other projects. For including your packages, there are two ways: 1) You create eggs out of your packages and install them. 2) You simply link them into your zope instance, as described below. *) What recipe do you use to fetch a package via svn? I simply check out the required package and link it in the lib/python directory of my zope instance and add the required zcml-files in the package-includes directory. I do this the same for my packages. Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users