From 30c66b0b2496f64832ab569f63215d84e0f0133f Mon Sep 17 00:00:00 2001 From: Lennart Regebro Date: Thu, 1 Apr 2010 13:48:03 +0000 Subject: [PATCH] A bug in the moderator panel meant you couldn't delete items in a virtual host, if your portal was named "plone". svn path=/plone.app.discussion/trunk/; revision=35608 --- CHANGES.txt | 3 +++ plone/app/discussion/browser/moderation.pt | 2 +- plone/app/discussion/browser/moderation.py | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8c35635..bb2fd5f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -54,6 +54,9 @@ Changelog * Added greek translation. [ggozad] +* A bug in the moderator panel meant you couldn't delete items in a virtual + host, if your portal was named "plone". + [regebro] 1.0b3 (2010-01-28) ------------------ diff --git a/plone/app/discussion/browser/moderation.pt b/plone/app/discussion/browser/moderation.pt index 90caa6c..c573e32 100644 --- a/plone/app/discussion/browser/moderation.pt +++ b/plone/app/discussion/browser/moderation.pt @@ -91,7 +91,7 @@ class="noborder" name="paths:list" id="#" value="#" - tal:attributes="value item/getPath; + tal:attributes="value python:view.item_path(item); id string:cb_${item/id}; checked item/checked|nothing; alt string:Select ${item/Title}; diff --git a/plone/app/discussion/browser/moderation.py b/plone/app/discussion/browser/moderation.py index 27cc767..d8313c9 100644 --- a/plone/app/discussion/browser/moderation.py +++ b/plone/app/discussion/browser/moderation.py @@ -44,6 +44,11 @@ class View(BrowserView): self.request.set('disable_border', True) context = aq_inner(self.context) + + # Help for path mangling + portal_url = getToolByName(context, 'portal_url') + self.portal_url = portal_url() + self.portal_path = portal_url.getPortalPath() catalog = getToolByName(context, 'portal_catalog') @@ -67,6 +72,11 @@ class View(BrowserView): return True else: return False + + def item_path(self, item): + # Path mangling to support virtual hosting + path = item.getPath()[len(self.portal_path):] + return self.portal_url + path class DeleteComment(BrowserView):