[Libreoffice-commits] .: Branch 'LiboExtensionCenter' - LiboExtensionWebsite/am.LiboExtensionCenter
Andreas Mantke
andreasma at kemper.freedesktop.org
Fri May 27 08:37:51 PDT 2011
LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.py | 77 +++++++++-
LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.pyc |binary
2 files changed, 75 insertions(+), 2 deletions(-)
New commits:
commit 4cbdd57a160b19b9acc6f0d0ba4e5ed03a0f91d2
Author: Andreas Mantke <maand at gmx.de>
Date: Fri May 27 17:37:35 2011 +0200
rework of __init__.py
diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.py b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.py
index 51e7de6..ad94f04 100644
--- a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.py
+++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.py
@@ -1,4 +1,77 @@
- # -*- extra stuff goes here -*-
+"""
+$Id: __init__.py 65648 2008-05-24 23:05:46Z maurits $
+"""
+
+from Products.CMFCore.utils import ContentInit
+from Products.CMFCore.DirectoryView import registerDirectory
+
+from Products.Archetypes.atapi import listTypes, process_types
+
+from am.LiboExtensionCenter import config
+from am.LiboExtensionCenter import permissions as lec_permissions
+from Products.CMFCore import permissions
+
+from Products.validation import validation
+from am.LiboExtensionCenter import validators
+validation.register(validators.ProjectIdValidator('isNonConflictingProjectId'))
+validation.register(validators.ProjectContactValidator('isValidContact'))
+
+registerDirectory(config.SKINS_DIR, config.GLOBALS)
def initialize(context):
- """Initializer called when used as a Zope 2 product."""
+ # Kick content registration and sys.modules mangling
+ from am.LiboExtensionCenter import content
+
+ allTypes = listTypes(config.PROJECTNAME)
+
+ # Register Archetypes content with the machinery
+ content_types, constructors, ftis = process_types(
+ allTypes, config.PROJECTNAME)
+
+ center_content_types = []
+ center_constructors = []
+
+ project_content_types = []
+ project_constructors = []
+
+ member_content_types = []
+ member_constructors = []
+
+ for i in range(len(allTypes)):
+ aType = allTypes[i]
+ if aType['klass'].meta_type in ('LiboExtensionCenter',):
+ center_content_types.append(content_types[i])
+ center_constructors.append(constructors[i])
+ elif aType['klass'].meta_type in ('LECProject',):
+ project_content_types.append(content_types[i])
+ project_constructors.append(constructors[i])
+ else:
+ member_content_types.append(content_types[i])
+ member_constructors.append(constructors[i])
+
+ # software center itself
+ ContentInit(
+ config.PROJECTNAME + ' Center',
+ content_types = tuple(center_content_types),
+ permission = lec_permissions.AddExtensionCenter,
+ extra_constructors = tuple(center_constructors),
+ fti = ftis,
+ ).initialize(context)
+
+ # projects
+ ContentInit(
+ config.PROJECTNAME + ' Project',
+ content_types = tuple(project_content_types),
+ permission = lec_permissions.AddProject,
+ extra_constructors = tuple(project_constructors),
+ fti = ftis,
+ ).initialize(context)
+
+ # regular content
+ ContentInit(
+ config.PROJECTNAME + ' Project Content',
+ content_types = tuple(member_content_types),
+ permission = permissions.AddPortalContent,
+ extra_constructors = tuple(member_constructors),
+ fti = ftis,
+ ).initialize(context)
diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.pyc b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.pyc
index 3c487e7..b2abe47 100644
Binary files a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.pyc and b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/__init__.pyc differ
More information about the Libreoffice-commits
mailing list