Re: [Zope3-Users] Containers Contains

2007-03-08 Thread Stephan Richter
On Sunday 28 January 2007 06:32, David Johnson wrote:
> This I know, so that is exactly my question.  What is the preferred  
> approach in Zope?  The contains and containers, or the more explicit  
> methods?

contains() and containers()

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Containers Contains

2007-01-28 Thread David Johnson
This I know, so that is exactly my question.  What is the preferred  
approach in Zope?  The contains and containers, or the more explicit  
methods?


On Jan 26, 2007, at 11:04 PM, Douglas Douglas wrote:

I think the errors are for the contained objects (the ones with  
'containers'
instructions on its schema definition). I use formlib and when I'm  
defining the
Forms I always omit the implicit fields '__parent__' and  
'__name__'. If you're
using addforms in ZCML you have to use the attribute option to  
specify all your

field but the ones above.

HTH. Regards, Douglas.

For more check this:
http://zope3.pov.lt/irclogs/%23zope3-dev.2006-04-24.log.html




__ 
__

Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at  
Yahoo! Games.

http://videogames.yahoo.com/platform?platform=120121



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


Re: [Zope3-Users] Containers Contains

2007-01-26 Thread David Johnson
Here is an example that gives me the IInputWidget errors when I use  
the contains/containers approach:

...interfaces.py...

class ICRM(IContainer):
"""Just a blank container to hold customers."""
contains('.ICustomer')

class ICustomer(IContainer,IContained):
"""A basic customer."""
contains('.IService')
containers(ICRM)

salesperson = Choice(
title = _(u'Sales Person'),
description = _(u'The sales person responsible for this  
account.'),

vocabulary = "Sales Person",
required=True)

supportperson = Choice(
title = _(u'Support Person'),
description = _(u'The support person responsible for this  
account.'),

vocabulary = "Support Person",
required=True)

class IService(IContained):
"""A service provided by the company."""
containers(ICustomer)

approveddate = Date(
title=_(u"Approved Date(-MM-DD)"),
description=_(u"The date this service was approved by  
finance."),

required=False)

...
class CRM(BTreeContainer):
"""Just a blank container to hold customers."""
implements(interfaces.ICRM)

class Customer(BTreeContainer):
implements(interfaces.ICustomer)
salesperson = u''
supportperson = u''

class Service(BTreeContainer):
implements(interfaces.IService)
approveddate = u''
...


On Jan 26, 2007, at 9:24 PM, Marius Gedminas wrote:


On Fri, Jan 26, 2007 at 07:48:36PM +0100, David Johnson wrote:

When setting up container/contained relationships, what is the proper
approach? Is it the approach outlined in Stephan's book with
IContainer, __setitem__, and preconditions?  Or is it "contains" and
"containers"?


contains() and containers() is a newer and prettier way to achieve the
same result.  It didn't exist when Stephan's book was written.


I have been having some problems and would be curious the definitive
approach.  The former is more complicated and so I find make lots of
coding errors.  The latter is simple but I find it causes strange
IInputWidget errors.


Could you show us some code?

Marius Gedminas
--
"Nuclear war can ruin your whole compile."
-- Karl Lehenbauer
___
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] Containers Contains

2007-01-26 Thread Marius Gedminas
On Fri, Jan 26, 2007 at 07:48:36PM +0100, David Johnson wrote:
> When setting up container/contained relationships, what is the proper  
> approach? Is it the approach outlined in Stephan's book with  
> IContainer, __setitem__, and preconditions?  Or is it "contains" and  
> "containers"?

contains() and containers() is a newer and prettier way to achieve the
same result.  It didn't exist when Stephan's book was written.

> I have been having some problems and would be curious the definitive  
> approach.  The former is more complicated and so I find make lots of  
> coding errors.  The latter is simple but I find it causes strange  
> IInputWidget errors.

Could you show us some code?

Marius Gedminas
-- 
"Nuclear war can ruin your whole compile."
-- Karl Lehenbauer


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


[Zope3-Users] Containers Contains

2007-01-26 Thread David Johnson
When setting up container/contained relationships, what is the proper  
approach? Is it the approach outlined in Stephan's book with  
IContainer, __setitem__, and preconditions?  Or is it "contains" and  
"containers"?


I have been having some problems and would be curious the definitive  
approach.  The former is more complicated and so I find make lots of  
coding errors.  The latter is simple but I find it causes strange  
IInputWidget errors.


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