Author: jmorliaguet
Date: Wed Apr  5 15:11:29 2006
New Revision: 2783

Added:
   cpsskins/branches/jmo-perspectives/configuration/fields/
   cpsskins/branches/jmo-perspectives/configuration/fields/__init__.py   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/fields/field.py   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/fields/meta.zcml   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/fields/metaconfigure.py   
(contents, props changed)
   cpsskins/branches/jmo-perspectives/configuration/fields/metadirectives.py   
(contents, props changed)
Log:

- added missing files



Added: cpsskins/branches/jmo-perspectives/configuration/fields/__init__.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/fields/__init__.py Wed Apr 
 5 15:11:29 2006
@@ -0,0 +1,19 @@
+##############################################################################
+#
+# 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/jmo-perspectives/configuration/fields/field.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/fields/field.py    Wed Apr 
 5 15:11:29 2006
@@ -0,0 +1,32 @@
+##############################################################################
+#
+# 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 implements, Interface
+
+class IField(Interface):
+    """A field."""
+
+class Field(object):
+
+    implements(IField)
+
+    def __init__(self, factory):
+        self.factory = factory
+

Added: cpsskins/branches/jmo-perspectives/configuration/fields/meta.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/fields/meta.zcml   Wed Apr 
 5 15:11:29 2006
@@ -0,0 +1,14 @@
+
+
+<configure xmlns="http://namespaces.zope.org/meta";>
+
+  <directives namespace="http://namespaces.zope.org/cpsskins";>
+
+    <directive
+       name="field"
+       schema=".metadirectives.IFieldDirective"
+       handler=".metaconfigure.field" />
+
+  </directives>
+
+</configure>

Added: cpsskins/branches/jmo-perspectives/configuration/fields/metaconfigure.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/fields/metaconfigure.py    
Wed Apr  5 15:11:29 2006
@@ -0,0 +1,49 @@
+##############################################################################
+#
+# 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.app.content.interfaces import IContentType
+from zope.configuration.exceptions import ConfigurationError
+from zope.component import queryUtility
+from zope.interface import alsoProvides
+
+from cpsskins import configuration
+from cpsskins.setup.interfaces import IResourceType
+
+def field(_context, name=u'', schema=None, factory=None):
+
+    if not name:
+        raise ConfigurationError("Must specify the field name.")
+
+    if queryUtility(configuration.IField, name) is not None:
+        raise ConfigurationError, \
+            "A field type named '%s' has already been registered." % name
+
+    if not schema:
+        raise ConfigurationError, \
+            "Must specify the field schema."
+
+    if not factory:
+        raise ConfigurationError("Must specify a field factory.")
+
+    # set up interface types
+    alsoProvides(schema, IResourceType)
+    alsoProvides(schema, IContentType)
+
+    schema.setTaggedValue('name', name)
+

Added: cpsskins/branches/jmo-perspectives/configuration/fields/metadirectives.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/configuration/fields/metadirectives.py   
Wed Apr  5 15:11:29 2006
@@ -0,0 +1,46 @@
+##############################################################################
+#
+# 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$
+"""
+__docfield__ = "reStructuredText"
+
+from zope.configuration.fields import GlobalObject, GlobalInterface
+from zope.interface import Interface
+from zope.i18nmessageid import MessageFactory
+from zope.schema import TextLine
+
+_ = MessageFactory("cpsskins")
+
+class IFieldDirective(Interface):
+
+    name = TextLine(
+        title=_(u"Name"),
+        description=_(u"The field's name"),
+        required=False,
+        default=u'',
+       )
+
+    schema = GlobalInterface(
+        title=_(u"Schema"),
+        description=_(u"The field's schema"),
+        required=False,
+        )
+
+    factory = GlobalObject(
+        title=_(u"Factory"),
+        description=_(u"The field's factory."),
+        required=False,
+        )
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to