Author: jmorliaguet
Date: Sat May  6 19:06:53 2006
New Revision: 3062

Added:
   cpsskins/branches/paris-sprint-2006/configuration/setup/
   cpsskins/branches/paris-sprint-2006/configuration/setup/__init__.py   
(contents, props changed)
   cpsskins/branches/paris-sprint-2006/configuration/setup/meta.zcml   
(contents, props changed)
   cpsskins/branches/paris-sprint-2006/configuration/setup/metaconfigure.py   
(contents, props changed)
   cpsskins/branches/paris-sprint-2006/configuration/setup/metadirectives.py   
(contents, props changed)
Modified:
   cpsskins/branches/paris-sprint-2006/configuration/meta.zcml
   cpsskins/branches/paris-sprint-2006/setup/registration.py

Log:

- added a cpsskins:setup directive for registering file-system sites:

  <cpsskins:setup site="...tgz" />



Modified: cpsskins/branches/paris-sprint-2006/configuration/meta.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/configuration/meta.zcml (original)
+++ cpsskins/branches/paris-sprint-2006/configuration/meta.zcml Sat May  6 
19:06:53 2006
@@ -24,4 +24,6 @@
 
   <include package=".settings" file="meta.zcml" />
 
+  <include package=".setup" file="meta.zcml" />
+
 </configure>

Added: cpsskins/branches/paris-sprint-2006/configuration/setup/__init__.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/configuration/setup/__init__.py Sat May 
 6 19:06:53 2006
@@ -0,0 +1,18 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"

Added: cpsskins/branches/paris-sprint-2006/configuration/setup/meta.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/configuration/setup/meta.zcml   Sat May 
 6 19:06:53 2006
@@ -0,0 +1,15 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope";
+    xmlns:meta="http://namespaces.zope.org/meta";>
+
+    <meta:directives namespace="http://namespaces.zope.org/cpsskins";>
+
+    <meta:directive
+        name="setup"
+        schema=".metadirectives.ISetupDirective"
+        handler=".metaconfigure.setup"
+        />
+
+    </meta:directives>
+
+</configure>

Added: cpsskins/branches/paris-sprint-2006/configuration/setup/metaconfigure.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/configuration/setup/metaconfigure.py    
Sat May  6 19:06:53 2006
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.configuration.exceptions import ConfigurationError
+
+from cpsskins.setup.registration import registerSite
+
+def setup(_context, site=u''):
+
+    if not site:
+        raise ConfigurationError("Must specify a site path.")
+
+    registerSite(site)

Added: cpsskins/branches/paris-sprint-2006/configuration/setup/metadirectives.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/configuration/setup/metadirectives.py   
Sat May  6 19:06:53 2006
@@ -0,0 +1,35 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.interface import Interface
+from zope.i18nmessageid import MessageFactory
+from zope.configuration.fields import Path
+
+_ = MessageFactory("cpsskins")
+
+class ISetupDirective(Interface):
+
+    site = Path(
+        title=_(u"Site"),
+        description=_(u"The path of the site to load."),
+        required=False,
+        default=u'',
+        )
+
+

Modified: cpsskins/branches/paris-sprint-2006/setup/registration.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/registration.py   (original)
+++ cpsskins/branches/paris-sprint-2006/setup/registration.py   Sat May  6 
19:06:53 2006
@@ -40,13 +40,11 @@
 
 ### Registration  #####################################################
 
-def registerSite(profile, file):
-    base_path = os.path.dirname(sys.modules.get(profile).__file__)
-    site_files.append({'filename': os.path.join(base_path, file)})
-
-def registerSettings(profile, file):
-    base_path = os.path.dirname(sys.modules.get(profile).__file__)
-    settings_files.append({'filename': os.path.join(base_path, file)})
+def registerSite(filename):
+    site_files.append(filename)
+
+def registerSettings(filename):
+    settings_files.append(filename)
 
 ### Loading sites, settings  ##########################################
 
@@ -66,8 +64,7 @@
 def loadSites():
     """Load all registered sites.
     """
-    for site_file in site_files:
-        filename = site_file['filename']
+    for filename in site_files:
         file = open(filename)
         importSite(file)
         file.close()
@@ -83,8 +80,7 @@
     """
     resources = getUtility(IResourceManager)
 
-    for file in settings_files:
-        filename = file['filename']
+    for filename in settings_files:
         dom = parse(filename)
         for setting_def in dom.getElementsByTagName('setting'):
             name = setting_def.getAttribute('name')
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to