From 6fd8a70ae8a09dbb425849b60e19ed8d0f417370 Mon Sep 17 00:00:00 2001 From: helmutm Date: Thu, 3 Jul 2008 05:50:01 +0000 Subject: [PATCH] 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 --- browser/common.py | 5 +++++ browser/node.py | 1 + compound/interfaces.py | 7 +++---- concept.py | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/browser/common.py b/browser/common.py index c224521..5a750b8 100644 --- a/browser/common.py +++ b/browser/common.py @@ -418,6 +418,11 @@ class BaseView(GenericView, I18NView): actions.extend(self.actions[category](self, page=page, target=target)) return actions + def getAdditionalActions(self, category='object', page=None, target=None): + """ Provide additional actions; override by subclass. + """ + return [] + @Lazy def showObjectActions(self): return not IUnauthenticatedPrincipal.providedBy(self.request.principal) diff --git a/browser/node.py b/browser/node.py index 12b22b3..20400f8 100644 --- a/browser/node.py +++ b/browser/node.py @@ -396,6 +396,7 @@ class NodeView(BaseView): target = self.virtualTarget if target is not None: actions.extend(target.getActions(category, page=self, target=target)) + actions.extend(self.view.getAdditionalActions(category, self, target)) return actions def getPortletActions(self, target=None): diff --git a/compound/interfaces.py b/compound/interfaces.py index d78b1f6..4027d1e 100644 --- a/compound/interfaces.py +++ b/compound/interfaces.py @@ -19,12 +19,11 @@ """ 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$ """ +#TODO: move generic stuff to cybertools.composer + from zope.interface import Interface, Attribute from zope import interface, component, schema @@ -79,7 +78,7 @@ class ICompound(IConceptSchema): parts given (a sequence) to the compound so that they are 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 context object has parts that are not in the ``parts`` argument they will be moved to the end of the list. diff --git a/concept.py b/concept.py index d344044..4321f70 100644 --- a/concept.py +++ b/concept.py @@ -406,7 +406,7 @@ class IndexAttributes(object): actx = adapted(ctx) indexAttrs = getattr(actx, '_textIndexAttributes', ()) #return ' '.join([getName(ctx), ctx.title, ctx.description] + - return ' '.join([self.title() + description] + + return ' '.join([self.title(), description] + self.creators() + [getattr(actx, attr, u'???') for attr in indexAttrs]).strip()