From 46f5b8e4641be4cf09b0031d60850d33d19f7c35 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Fri, 8 Mar 2013 16:16:25 +0100 Subject: [PATCH] [gen] Removed obsolete code; a Page instance that does not have sub-pages does not show the portlet. --- gen/mixins/ToolMixin.py | 5 ----- gen/wrappers/PageWrapper.py | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gen/mixins/ToolMixin.py b/gen/mixins/ToolMixin.py index b740a97..27a41be 100644 --- a/gen/mixins/ToolMixin.py +++ b/gen/mixins/ToolMixin.py @@ -903,11 +903,6 @@ class ToolMixin(BaseMixin): res.append(row) return res - def truncate(self, value, numberOfChars): - '''Truncates string p_value to p_numberOfChars.''' - if len(value) > numberOfChars: return value[:numberOfChars] + '...' - return value - # -------------------------------------------------------------------------- # Authentication-related methods # -------------------------------------------------------------------------- diff --git a/gen/wrappers/PageWrapper.py b/gen/wrappers/PageWrapper.py index bdf49d5..ac879eb 100644 --- a/gen/wrappers/PageWrapper.py +++ b/gen/wrappers/PageWrapper.py @@ -12,6 +12,11 @@ class PageWrapper(AbstractWrapper): '''Show the sub-pages.''' if self.user.has_role('Manager'): return 'view' + def showPortlet(self): + '''Do not show the portlet for a page, unless sub-pages arre defined.''' + if self.isEmpty('pages'): return False + return True + def onEdit(self, created): return self._callCustom('onEdit', created) # ------------------------------------------------------------------------------