[Zope3-Users] Re: Conflicting configuration actions for protectName __setitem__
Philipp von Weitershausen wrote: Rob Campbell wrote: Ok, that's what I thought. How can I fix the problem? What problem? (Yeah, I know, I could read your original post now but I think you'll be able to figure it out by youself now. You'll just have to work with the fact that contains() adds a __setitem__ declaration to your interface.) The problem is that I am getting the following error when starting zope. zope.configuration.config.ConfigurationConflictError: Conflicting configuration actions For: ('protectName', , '__setitem__') In zcml I have require subdirectives for FosterRecord. They set permissions for zope.app.container.interfaces.IReadContainer/IWriteContainer and IFosterRecord, along with set_schema for IFosterRecord. I started getting the errors when I added IReadContainer and IWriteContainer. Is the problem coming from contains() and a schema being in the same interface? Or am I doing something wrong in the zcml? I'm very new to zope, and this is my first attempt at using it. I have your book, and I'm looking forward to the new edition. I think I can create an IFosterSourceContainer interface and have the constraint there. Then I would have to implement that interface for FosterRecord. Would that work? Also, is there any other/better way to do it? *Usually* we only deal with contains() within IContainer-derived interfaces anyway. That doesn't mean you have to go and implement IContainer now. -- Rob Campbell ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Conflicting configuration actions for protectName __setitem__
Ok, that's what I thought. How can I fix the problem? I think I can create an IFosterSourceContainer interface and have the constraint there. Then I would have to implement that interface for FosterRecord. Would that work? Also, is there any other/better way to do it? -- Rob Campbell Philipp von Weitershausen wrote: Rob Campbell wrote: Hi Darryl, That is how I had the IFosterRecord interface before, and I got a lot more errors than just __setitem__. I am only getting the __setitem__ error now, after changing it to something like: class IFosterRecord(Interface): contains('.IFosterSource') title = TextLine(...) and the implementation is: class FosterRecord(BTreeContainer): implements(IFosterRecord) title = FieldProperty(IFosterRecord['title']) I think the problem is coming from contains(). Yup. contains() adds a __setitem__ method to the interface. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Conflicting configuration actions for protectName __setitem__
Hi Darryl, That is how I had the IFosterRecord interface before, and I got a lot more errors than just __setitem__. I am only getting the __setitem__ error now, after changing it to something like: class IFosterRecord(Interface): contains('.IFosterSource') title = TextLine(...) and the implementation is: class FosterRecord(BTreeContainer): implements(IFosterRecord) title = FieldProperty(IFosterRecord['title']) I think the problem is coming from contains(). Do I need to create another interface just for the contains()? Maybe something like IFosterSourceContainer. Or is there another way to fix this error? Thank you for the reply. -- Rob Campbell Darryl Cousins wrote: Hi Rob, __setitem__ is likely also part of your IFosterRecord interface. class IFosterRecord(IContainer) #? and this is causing the conflict. Regards, Darryl On Tue, 2006-09-19 at 15:35 -0700, Rob Campbell wrote: I know I read about this error somewhere before, but I haven't been able to find anything through Google searches. I have a container that also has it's own attributes. I am calling zope.app.container.constraints.contains from IFosterRecord, is that what is causing the __setitem__ problem? Here is the traceback I have been getting: zope.configuration.config.ConfigurationConflictError: Conflicting configuration actions For: ('protectName', , '__setitem__') File "/opt/zope/instance/lib/python/rats/configure.zcml", line 25.2-45.2 interface='zope.app.container.interfaces.IContainerNamesContainer' /> ___ 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
[Zope3-Users] Conflicting configuration actions for protectName __setitem__
I know I read about this error somewhere before, but I haven't been able to find anything through Google searches. I have a container that also has it's own attributes. I am calling zope.app.container.constraints.contains from IFosterRecord, is that what is causing the __setitem__ problem? Here is the traceback I have been getting: zope.configuration.config.ConfigurationConflictError: Conflicting configuration actions For: ('protectName', , '__setitem__') File "/opt/zope/instance/lib/python/rats/configure.zcml", line 25.2-45.2 -- Rob Campbell ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with containers
Martijn Pieters wrote: On 9/15/06, Rob Campbell <[EMAIL PROTECTED]> wrote: I just recently started trying out Zope 3. My first test project is a few containers that can contain other containers or an object. They are laid out as follows: FosterRecord -> FosterSource -> Foster -> FosterGroup -> Foster A FosterRecord is the top level container and can contain a FosterSource. A FosterSource can contain a Foster object or a FosterGroup. And a FosterGroup can contain a Foster object. You cannot combine multiple contained or container constraints; you'll have to define a contained contstraint for the Foster implementation that includes both IFosterSource and IFosterGroup. Ok, so it can't be done by implementing both IFosterSourceContained and IFosterGroupContained? I am doing that currently with the following code: class Foster(Contained): implements(IFoster, IFosterSourceContained, IFosterGroupContained) Would I need to create a new IContained interface? Maybe something like this: class IFosterSourceOrGroupContained(IContained): containers(IFosterSourceContainer, IFosterGroupContainer) and then change Foster to this: class Foster(IContained): implements(IFoster, IFosterSourceOrGroupContained) Thank you for the help. -- Rob Campbell ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Problem with containers
Hello, I just recently started trying out Zope 3. My first test project is a few containers that can contain other containers or an object. They are laid out as follows: FosterRecord -> FosterSource -> Foster -> FosterGroup -> Foster A FosterRecord is the top level container and can contain a FosterSource. A FosterSource can contain a Foster object or a FosterGroup. And a FosterGroup can contain a Foster object. I setup this relationship with IContainer and IContained interfaces and calls to contains() and containers(). I start adding containers and objects to create this structure through the ZMI. When I am ready to add a FosterGroup or a Foster to a FosterSource, I do not get any options for them in the add menu. I haven't been able to find what is causing it. I would guess it has something to do with the constraints. I am running this on Zope 3.3.0b2. I am attaching my interfaces.py, foster.py and configure.zcml. Does anyone know what is causing this problem? Also, since I am new to Zope, does anyone have any suggestions on a better or cleaner way of implementing this? Thank you. -- Rob Campbell from zope.interface import Interface from zope.schema import Text, TextLine, Int, Date, Bool, Choice, Field from zope.app.container.constraints import containers, contains from zope.app.container.interfaces import IContainer, IContained class IFosterRecord(Interface): """A FosterRecord. """ title = TextLine( title=u'Title', description=u'Title of FosterRecord', required=True ) class IFosterSource(Interface): """A FosterSource. """ title = TextLine( title=u'Title', description=u'Title of FosterSource', required=True ) class IFosterGroup(Interface): """A FosterGroup. """ title = TextLine( title=u'Title', description=u'Title of FosterSource', required=True ) class IFoster(Interface): """Information about a foster. """ # id = Int( #title=u'Foster ID', #description=u'ID number of the foster', #required=True # ) nickname = TextLine( title=u'Nickname', description=u'Nickname of the foster', required=False ) history = Text( title=u'History', description=u'History of the foster', required=False ) markings = Text( title=u'Markings', description=u'The foster\'s markings', required=True ) personality = Text( title=u'Personality', description=u'Personality of the foster', required=False ) health = Choice( title=u'Health', description=u'Health of the foster', values=('Good', 'Minor', 'Major', 'Undetermined'), required=True ) healthInfo = Text( title=u'Health Information', description=u'Additional health information', required=False ) bornOn = Date( title=u'Born On', description=u'Date on which foster was born', required=True ) bornApprox = Bool( title=u'Approx.', description=u'Approximate date', required=True ) gender = Choice( title=u'Gender', description=u'Gender of the foster', values=('Male', 'Female', 'Undetermined'), required=True ) fixed = Bool( title=u'Fixed', description=u'If the foster has been fixed', required=True ) fixedOn = Date( title=u'Fixed On', description=u'Date the foster was fixed', required=False ) receivedOn = Date( title=u'Received On', description=u'Date the foster was received', required=True ) adoptedOn = Date( title=u'Adopted On', description=u'Date the foster was adopted', required=False ) adoptedBy = TextLine( title=u'Adopted By', description=u'Person who adopted the foster', required=False ) pregnancyWatch = Choice( title=u'Pregnancy Watch', description=u'Pregnancy watch status', values=('On', 'Cleared', 'Pregnant', 'N/A'), required=True ) pregnancyWatchEndsOn = Date( title=u'Pregnancy Watch Ends On', description=u'Date when pregnancy watch expires', required=False ) transferedOn = Date( title=u'Ttransfered On', description=u'Date of transfer', required=False ) transferedTo = TextLine( title=u'Transfered To', description=u'Person to which foster was transfered', required=