[Zope3-Users] Traverse to nearest site in menu action

Florian Lindner mailinglists at xgm.de
Sun Apr 3 17:30:03 EDT 2005


Am Freitag, 1. April 2005 22:36 schrieb Stephan Richter:
> On Thursday 31 March 2005 09:23, Florian Lindner wrote:
> > How can I make one of my objects able to be contain a site. Using
> > zope.app.component.interfaces.IPossibleSite as a marker interface (like
> > <implements interface="zope.app.component.interfaces.IPossibleSite" />
> > in the <content> directive) does not make it. There is a link to add a
> > site, but I get a system error when trying to add it.
>
> Can you send the traceback? Though I think you simply forgot the security
> declarations, so that the necessary methods are not publically available.
>
>     <allow
>         attributes="getSiteManager"
>         />
>     <require
>         permission="zope.ManageServices"
>         attributes="setSiteManager"
>         />
>

My configure.zcml:

    <interface interface=".interfaces.ICentershock"
        type="zope.app.content.interfaces.IContentType" />
    
    <content class=".centershock.Centershock">
        <implements
           interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
        <implements
           interface="zope.app.container.interfaces.IContentContainer" />
        <implements 
           interface="zope.app.component.interfaces.IPossibleSite" />
        <factory description="centershock.net"/>
        <require permission="zope.Public"
            interface=".interfaces.ICentershock" />
        <require permission="zope.Public"
            set_schema=".interfaces.ICentershock" />
        <allow
            attributes="getSiteManager" />
        <require
            permission="zope.ManageServices"
            attributes="setSiteManager" />
    </content>

I'm logged in as zope.Manager.

The traceback when I hit "Webplatz erstellen" (Make site).


2005-04-03T17:24:33 ERROR SiteError 
http://localhost:8080/cs/addSiteManager.html
Traceback (most recent call last):
  File "/home/florian/Zope3/src/zope/publisher/publish.py", line 138, in 
publish
    result = publication.callObject(request, object)
  File "/home/florian/Zope3/src/zope/app/publication/zopepublication.py", line 
155, in callObject
    return mapply(ob, request.getPositionalArguments(), request)
  File "/home/florian/Zope3/src/zope/publisher/publish.py", line 113, in 
mapply
    return debug_call(object, args)
  File "/home/florian/Zope3/src/zope/publisher/publish.py", line 119, in 
debug_call
    return object(*args)
  File "/home/florian/Zope3/src/zope/app/component/browser/__init__.py", line 
178, in addSiteManager
    self.context.setSiteManager(sm)
AttributeError: 'Centershock' object has no attribute 'setSiteManager'
127.0.0.1 - zope.manager [3/Apr/2005:17:24:33 -0300] 
"GET /cs/addSiteManager.html HTTP/1.1" 500 311 
"http://localhost:8080/cs/@@contents.html" "Mozilla/5.0 (compatible; 
Konqueror/3.3; Linux) (KHTML, like Gecko)"


The object I try to add the site to was created after I add the missing 
permission declaration.

> > Or directly inherit from zope.app.folder.interfaces.IFolder?
>
> That would work too, but it might have unwanted side-effects.

Ok, prefer the other way.

Thanks,

Florian


More information about the Zope3-users mailing list