No, not exactly. IFolder is derived from IPossibleSite. In any case getting all the permissions right can be tricky. Even when you think you've gotten you find later you missed one here or there. That's why I like deriving from IFolder. The kinks have been worked out and where I forget something IFolder and Folder probably provide default implementations. It just tends to work better all around.

On Jan 22, 2007, at 4:02 PM, Roy Mathew wrote:

Thanks, David - that did the trick.

I changed the decl:
  class IQSite(IPossibleSite):
  class IQSite(IFolder):

and had to remove the IWriteContainer and IReadContainer perm decls to
avoid a conflict.

I am still not sure why that would make the difference - since QSite
extended Folder to begin with, wasn't it also of type IFolder?


David Johnson writes:
 From my experience I find it better to derive from IFolder for the
interface and Folder for the class.   I can then set which objects
are allowed or not allowed to be added based on the standard
preconditions/IContained lines in the interface definitions.  I set
the schema to the primary interface of my class.

On Jan 22, 2007, at 1:06 AM, Roy Mathew wrote:

Hi Folks,

I am trying to create a custom Site object, using the below
declarations; all goes well when addding an object O1 to the QSite,
but when trying to delete object O1, I get:

ForbiddenAttribute: ('__delitem__', <...QSite object at 0xa61dcd6c>)

The code:

  class IQSite(IPossibleSite):
    "custom site"

  class QSite(Folder, site.SiteManagerContainer):

  <class class=".qtmodule.QSite">
     <require permission="zope.View"
        interface="" />
     <require permission="zope.ManageContent"
set_schema="" />

     <require permission="zope.Public"
interface=".interfaces.IQSite" />
     <require permission="zope.ManageContent"
set_schema=".interfaces.IQSite" />

Since both __setitem__ and __getitem__ belong to the same interface,
I am baffled - what gives?

Roy Mathew.
Zope3-users mailing list

Zope3-users mailing list

Reply via email to