allow BaseView subclasses to provide 'additional' actions; (+some minor fixes)

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2734 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-07-03 05:50:01 +00:00
parent 2ae267c6c1
commit 6fd8a70ae8
4 changed files with 10 additions and 5 deletions

View file

@ -418,6 +418,11 @@ class BaseView(GenericView, I18NView):
actions.extend(self.actions[category](self, page=page, target=target)) actions.extend(self.actions[category](self, page=page, target=target))
return actions return actions
def getAdditionalActions(self, category='object', page=None, target=None):
""" Provide additional actions; override by subclass.
"""
return []
@Lazy @Lazy
def showObjectActions(self): def showObjectActions(self):
return not IUnauthenticatedPrincipal.providedBy(self.request.principal) return not IUnauthenticatedPrincipal.providedBy(self.request.principal)

View file

@ -396,6 +396,7 @@ class NodeView(BaseView):
target = self.virtualTarget target = self.virtualTarget
if target is not None: if target is not None:
actions.extend(target.getActions(category, page=self, target=target)) actions.extend(target.getActions(category, page=self, target=target))
actions.extend(self.view.getAdditionalActions(category, self, target))
return actions return actions
def getPortletActions(self, target=None): def getPortletActions(self, target=None):

View file

@ -19,12 +19,11 @@
""" """
Compound objects like articles, blog posts, storyboard items, ... Compound objects like articles, blog posts, storyboard items, ...
This is somehow related to cybertools.composer - so maybe we should
move part of the code defined here to that more generic package.
$Id$ $Id$
""" """
#TODO: move generic stuff to cybertools.composer
from zope.interface import Interface, Attribute from zope.interface import Interface, Attribute
from zope import interface, component, schema from zope import interface, component, schema
@ -79,7 +78,7 @@ class ICompound(IConceptSchema):
parts given (a sequence) to the compound so that they are parts given (a sequence) to the compound so that they are
ordered according to this sequence. ordered according to this sequence.
If the parts`` argument contains a value that is not If the ``parts`` argument contains a value that is not
in the context objects`s list of parts raise an error. If the in the context objects`s list of parts raise an error. If the
context object has parts that are not in the ``parts`` argument context object has parts that are not in the ``parts`` argument
they will be moved to the end of the list. they will be moved to the end of the list.

View file

@ -406,7 +406,7 @@ class IndexAttributes(object):
actx = adapted(ctx) actx = adapted(ctx)
indexAttrs = getattr(actx, '_textIndexAttributes', ()) indexAttrs = getattr(actx, '_textIndexAttributes', ())
#return ' '.join([getName(ctx), ctx.title, ctx.description] + #return ' '.join([getName(ctx), ctx.title, ctx.description] +
return ' '.join([self.title() + description] + return ' '.join([self.title(), description] +
self.creators() + self.creators() +
[getattr(actx, attr, u'???') for attr in indexAttrs]).strip() [getattr(actx, attr, u'???') for attr in indexAttrs]).strip()