Re: @@get_viewer_role_info
Martijn Faassen <faassen-oFAYkll9/[email protected]> Wed, 13 Jun 2007 18:56:39 +0200
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Message-ID | <[email protected]> |
Hey, Andy Altepeter wrote: > I'm trying to call zope3/five registered view in the subject of this email but > it appears to not be registered for all types of Silva objects. > > As a manager I have access to call this view directly from my browser, e.g. > http://mysite.com/silva/folder/document/@@get_viewer_role_info > > This works for "Silva Document", "Silva Folder" and "Silva Publication". > However, it does not work for "Silva Document Version" nor "Silva Article". > I'm trying to figure out why, but coming up short. This view is registered > for="Products.Silva.interfaces.ISilvaObject", so I don't know why it's not > working. The reason this is not working for SilvaDocumentVersion is because Silva DocumentVersion is not an ISilvaObject. You could either add a ZCML registration to register it for versions as well (if the view still works), or use the 'get_content()' method on the version (acquired) to get to the nearest ISilvaObject (the SilvaDocument). This leaves the mystery of it not working in Silva Article, because it should. Silva Article subclasses from NewsItem which subclasses from CatalogedVersionContent which subclasses from VersionedContent (pauses for breath.. those wonderfully deeply nested Zope 2 base classes) which subclasses from Content (among others), which subclasses from SilvaObject which *does not* appear to say 'implements(ISilvaObject)'. That appears wrong. We should add this line to SilvaObject's class definition. It also doesn't appeared to be fixed on trunk, so it should be added there as well (as well to any release branches). Should be safe, but needs to be tested first. So why does it work for other content types even though we have this bug? The reason it works with other types of content is because they implement IContent or IVersionedContent (through the Content or VersionedContent base classes), which derives from ISilvaObject. Regards, Martijn