From d45e314ac105ce9c402378cf3c91cc089c52550c Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Fri, 17 May 2013 15:00:31 +0200 Subject: [PATCH] [gen] Calendar: bugfix; wrapper.appyUser returns the admin if the user is 'System Processes', the virtual user that runs when Zope is starting. --- gen/calendar.py | 5 ++++- gen/installer.py | 2 +- gen/wrappers/__init__.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gen/calendar.py b/gen/calendar.py index 55516a8..ae41c7e 100644 --- a/gen/calendar.py +++ b/gen/calendar.py @@ -310,7 +310,10 @@ class Calendar(Type): currentDate = res[i][0] lastDate = res[i][1] previousDate = res[i-1][0] - if previousDate == (currentDate-1): + currentType = res[i][2].eventType + previousType = res[i-1][2].eventType + if (previousDate == (currentDate-1)) and \ + (previousType == currentType): # A merge is needed del res[i] res[i-1][1] = lastDate or currentDate diff --git a/gen/installer.py b/gen/installer.py index 93c03a3..3fe50eb 100644 --- a/gen/installer.py +++ b/gen/installer.py @@ -414,9 +414,9 @@ class ZopeInstaller: self.enableUserTracking() self.configureSessions() self.installBaseObjects() - self.installCatalog() # The following line cleans and rebuilds the catalog entirely. #self.app.config.appy().refreshCatalog() + self.installCatalog() self.installTool() self.installUi() # Perform migrations if required diff --git a/gen/wrappers/__init__.py b/gen/wrappers/__init__.py index 72713bd..eb6d19f 100644 --- a/gen/wrappers/__init__.py +++ b/gen/wrappers/__init__.py @@ -115,8 +115,11 @@ class AbstractWrapper(object): elif name == 'user': return self.o.getUser() elif name == 'appyUser': - return self.search1('User', noSecurity=True, + user = self.search1('User', noSecurity=True, login=self.o.getUser().getId()) + if user: return user + if self.o.getUser().getUserName() == 'System Processes': + return self.search1('User', noSecurity=True, login='admin') elif name == 'fields': return self.o.getAllAppyTypes() elif name == 'siteUrl': return self.o.getTool().getSiteUrl() # Now, let's try to return a real attribute.