[Zope3-Users] Master-slave forms with formlib

2006-07-10 Thread Lorenzo Gil Sanchez

Hi,

I want to write a form using the common pattern Master-Slave where there 
are some fields related to a master object and then a subform (the 
slave) with a tabular view of the children of that objet. Something 
similar to:


Personal Information
-

Name: [___]
Age:  [___]

Friends:
+--+---+--+
| Name | Cellphone | City |
+--+---+--+
| Mary | 0 | NY   |
| Pete | 1 | LA   |
+--+---+--+

As you can see we have two content objects: Person and Friend where a 
person has two attributes (name and age) and friend has three attributes 
(name, cellphone and city).


First question:

- If I want to write a form with a master-slave sort of functionality 
how should I define my content types?:


  a) Person is a container that can contains objects of type Friend

  b) Person has a list attribute where I can add/remove objects of type 
Friend using a specific API


Second question:

- Can I write a subform with the Friends tabular view and reuse that 
form in other places, not just in the Person edit form? The minimun 
functionality this subform should have would be adding, removing and 
editing objects of type Friend. Sorting them by columns or filtering 
would be added in the future.


Any tip about how to do this using formlib would be appreciated. I have 
used it for simple content types and I like it a lot.


Thanks in advance

Lorenzo Gil
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: testrunner layers example and classmethods

2006-07-10 Thread Philipp von Weitershausen
Paul Winkler wrote:
 I have a need to have a batch of tests that do some expensive
 setup once for the whole batch.  AFAICT this is what layers are for.

Indeed.

 One question though... Why do the examples in
 zope/testing/testrunner-ex/samplelayers.py have setUp() and tearDown()
 as classmethods?

Because the test runner expects layers to be objects with setUp() and
tearDown() methods. So, if you want to pass a class without
instantiating it first, you need to make these class methods so that
they don't expect 'self' as the first argument.

 Is it just an implementation detail of those tests, or something
 I should be aware of when creating my own layers?

Just pass in any object that has 'setUp' and 'tearDown' callables as
attributes :).

Philipp

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] IRelationshipMapper

2006-07-10 Thread Gary Poster


On Jul 10, 2006, at 10:09 PM, Gary Poster wrote:
Jim built the nice-n-simple zc.extrinsicreference package for a  
good way to make back- references to Python references.


Apologies: Benji York built the nice-n-simple zc.extrinsicreference  
package. :-)


Gary
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users