remove unnecessary paths variable for BulkActionView methods, set self.paths instead.

svn path=/plone.app.discussion/trunk/; revision=27722
This commit is contained in:
Timo Stollenwerk 2009-06-29 13:44:46 +00:00
parent 2bc25c06de
commit 7e3de6ae0a

View File

@ -123,40 +123,40 @@ class BulkActionsView(BrowserView):
bulkaction = self.request.get('form.select.BulkAction') bulkaction = self.request.get('form.select.BulkAction')
paths = self.request.get('paths') self.paths = self.request.get('paths')
if bulkaction == '-1': if bulkaction == '-1':
# no bulk action was selected # no bulk action was selected
pass pass
elif bulkaction == 'retract': elif bulkaction == 'retract':
self.retract(paths) self.retract()
elif bulkaction == 'publish': elif bulkaction == 'publish':
self.publish(paths) self.publish()
elif bulkaction == 'mark_as_spam': elif bulkaction == 'mark_as_spam':
self.mark_as_spam(paths) self.mark_as_spam()
elif bulkaction == 'delete': elif bulkaction == 'delete':
self.delete(paths) self.delete()
else: else:
raise KeyError raise KeyError
def retract(self, paths): def retract(self):
raise NotImplementedError raise NotImplementedError
def publish(self, paths): def publish(self):
context = aq_inner(self.context) context = aq_inner(self.context)
for path in paths: for path in self.paths:
comment = context.restrictedTraverse(path) comment = context.restrictedTraverse(path)
portal_workflow = getToolByName(comment, 'portal_workflow') portal_workflow = getToolByName(comment, 'portal_workflow')
portal_workflow.doActionFor(comment, 'publish') portal_workflow.doActionFor(comment, 'publish')
catalog = getToolByName(comment, 'portal_catalog') catalog = getToolByName(comment, 'portal_catalog')
catalog.reindexObject(comment) catalog.reindexObject(comment)
def mark_as_spam(self, paths): def mark_as_spam(self):
raise NotImplementedError raise NotImplementedError
def delete(self, paths): def delete(self):
context = aq_inner(self.context) context = aq_inner(self.context)
for path in paths: for path in self.paths:
comment = context.restrictedTraverse(path) comment = context.restrictedTraverse(path)
conversation = aq_parent(comment) conversation = aq_parent(comment)
del conversation[comment.id] del conversation[comment.id]