[Zope3-Users] Re: 403 error upon using addform

Florian Lindner mailinglists at xgm.de
Sat Nov 20 05:36:21 EST 2004


jürgen Kartnaller schrieb:
> Hi Florian,
> your problem has to do with the permission zope.Public .
> 
> For testing I changed the permissions in my application from 
> zope.ManageContent to zope.Public.
> After that I got the same error you describe.
> 
> As a workaround you should change the permissions in your configuration 
> to zope.ManageContent, or you try to setup your own permissions (I have 
> not used this until now but the zope 3 book explains this).

I've set the permission to Zope.View, it works this way. But sound like 
a bug, doesn't it?
X-Post to zope3-dev.

> I don't know the reason for this, I just give you this workaround.
> 
> Jürgen
> 
> Florian Lindner wrote:
> 
>> Mmhh, too trvial, too complicated are you too busy?  ;-)
>>
>> I would really appreciate an answer, cause I'm stuck at this point...
>>
>> Thanks Stephan,
>>
>> Florian
>>
>> Florian Lindner schrieb:
>>
>>> Stephan Richter schrieb:
>>>
>>>> On Sunday 14 November 2004 11:11, Florian Lindner wrote:
>>>>
>>>>> But when I fill in the id input field in the form and submit I just 
>>>>> get
>>>>> a Unauthorized (403) error message, also I am logged in as a manager.
>>>
>>>
>>>
>>>
>>> One addition: It's exactly the same behavior when I'm not logged in 
>>> (working as anonymous).
>>>
>>>> Can you provide the traceback? Just because you are a manager, you 
>>>> cannot do everything. If a particular attribute has no security 
>>>> declaration, it is accessible by noone.
>>>
>>>
>>>
>>>
>>> I haven't translated it, but I'm sure you know what the fields are:
>>>
>>> Zeit: Tue Nov 16 11:41:50 2004
>>> Benutzer: florian, zope.manager, Manager,
>>> Anfrage-URL: 
>>> http://localhost:8080/++skin++centershock/eventfolder/+/AddCSEvent.html%3Dabc 
>>>
>>> Ausnahmetyp: Unauthorized
>>> Ausnahmewert: ('browserDefault', 'zope.Public')
>>>
>>> Zurückverfolgung:
>>>
>>> Traceback (innermost last):
>>>
>>> * Module zope.publisher.publish, line 135, in publish
>>>   object = request.traverse(object)
>>> * Module zope.publisher.browser, line 507, in traverse
>>>   ob, add_steps = publication.getDefaultTraversal(self, ob)
>>> * Module zope.app.publication.browser, line 52, in getDefaultTraversal
>>>   return ob.browserDefault(request)
>>>
>>> Unauthorized: ('browserDefault', 'zope.Public')
>>>
>>>
>>>>> Another questions is why there is only one field although the 
>>>>> schema at
>>>>> CS.interfaces.IEvent definied some other fields? 
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> This is strange. Did you setup something incorreclty?
>>>
>>>
>>>
>>>
>>> Probably... But what?
>>>
>>>>> The ZCML reference says:
>>>>> "The fields and the order in which to display them. If this is not
>>>>> specified, all schema fields will be displayed in the order 
>>>>> specified in
>>>>> the schema itself."
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> This is the doc string for the "fields" attribute. As you can read, 
>>>> all fields should be displayed. It might be good to also send us 
>>>> your IEvent interface.
>>>
>>>
>>>
>>>
>>> I know, that's why I copied it here.
>>>
>>> This is my complete CS.interfaces (CS\interfaces.py)
>>>
>>> from zope.interface import Interface
>>> from zope.app.container.interfaces import IContainer, IContained
>>> from zope.schema import TextLine, Text, Field
>>> from zope.app.container.constraints import ItemTypePrecondition, 
>>> ContainerTypesConstraint
>>>
>>> class IEvent(Interface):
>>>     """This interface stores information about a event."""
>>>
>>>     def __setitem__(name, object):
>>>         """Add a IEvent object."""
>>>
>>>     name = TextLine(
>>>         title = u"Name",
>>>         description = u"Short name",
>>>         required = True)
>>>
>>>     description = Text (
>>>         title = u"Description",
>>>         description = u"Longer description of the event",
>>>         default = u"",
>>>         required = False)
>>>
>>>     location = Text (
>>>         title = u"Location",
>>>         description = u"The location where the event take place.",
>>>         default = u"",
>>>         required = False)
>>>
>>> class IEventFolder(IContainer):
>>>     def __setitem__(name, object):
>>>         """Adds a IEventFolder object."""
>>>
>>>     __setitem__.precondition = ItemTypePrecondition(IEvent)
>>>
>>>
>>> class IEventContained(IContained):
>>>     __parent__ = Field( constraint = 
>>> ContainerTypesConstraint(IEventFolder))
>>>
>>>
>>> And my configure.zcml (CS\configure.zcml)
>>>
>>> <configure xmlns="http://namespaces.zope.org/zope">
>>>   <include package=".Principal" />
>>>   <include package=".browser" />
>>>
>>>   <interface interface=".interfaces.IEventFolder" 
>>> type="zope.app.content.interfaces.IContentType" />
>>>   <content class=".event.EventFolder">
>>>     <implements 
>>> interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
>>>     <implements 
>>> interface="zope.app.container.interfaces.IContentContainer" />
>>>     <factory id="CS.event.EventFolder" description="CS EventFolder"/>
>>>     <require permission="zope.Public" 
>>> interface=".interfaces.IEventFolder" />
>>>     <require permission="zope.Public" 
>>> set_schema=".interfaces.IEventFolder" />
>>>     </content>
>>>       <interface interface=".interfaces.IEvent" 
>>> type="zope.app.content.interfaces.IContentType" />
>>>     <content class=".event.Event">
>>>     <implements 
>>> interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
>>>     <factory id="CS.event.Event" description="CS Event"/>
>>>     <require permission="zope.Public" interface=".interfaces.IEvent" />
>>>     <require permission="zope.Public" set_schema=".interfaces.IEvent" />
>>> </content>
>>>
>>> </configure>
>>>
>>> Anything else you need?
>>>
>>> TIA,
> 
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
> 



More information about the Zope3-users mailing list