appy.gen: added the possibility to create and manage web pages into an app; every class can now define a method showPortlet. If the class does not define it or if it returns False, the portlet won't be shown when showing/editing instances of this class.

This commit is contained in:
Gaetan Delannay 2012-03-26 19:09:45 +02:00
parent 8aa03a091a
commit 1e9e4df5a6
9 changed files with 113 additions and 28 deletions

View file

@ -18,8 +18,14 @@ def createObject(folder, id, className, appName, wf=True):
obj.portal_type = className
obj.id = id
obj._at_uid = id
userId = obj.getUser().getId()
# If user is anonymous, userIs is None
user = obj.getUser()
if not user.getId():
if user.name == 'System Processes':
userId = 'admin' # This is what happens when Zope is starting.
else:
userId = None # Anonymous.
else:
userId = user.getId()
obj.creator = userId or 'Anonymous User'
from DateTime import DateTime
obj.created = DateTime()