Author: jmorliaguet
Date: Sun May 21 17:00:07 2006
New Revision: 3179

Added:
   cpsskins/branches/paris-sprint-2006/setup/fields.txt   (contents, props 
changed)
   cpsskins/branches/paris-sprint-2006/standard/fields/image.py   (contents, 
props changed)
   cpsskins/branches/paris-sprint-2006/standard/fields/image.zcml   (contents, 
props changed)
   cpsskins/branches/paris-sprint-2006/standard/filters/style/README.txt   
(contents, props changed)
Modified:
   cpsskins/branches/paris-sprint-2006/elements/interfaces.py
   cpsskins/branches/paris-sprint-2006/ftests/test_appsetup.py
   cpsskins/branches/paris-sprint-2006/setup/README.txt
   cpsskins/branches/paris-sprint-2006/setup/io/README.txt
   cpsskins/branches/paris-sprint-2006/setup/manager.py
   cpsskins/branches/paris-sprint-2006/standard/fields/color.py
   cpsskins/branches/paris-sprint-2006/standard/fields/color.zcml
   cpsskins/branches/paris-sprint-2006/standard/fields/configure.zcml
   cpsskins/branches/paris-sprint-2006/standard/filters/style/__init__.py
   cpsskins/branches/paris-sprint-2006/tests/setup.py
   cpsskins/branches/paris-sprint-2006/tests/test_filters.py
   cpsskins/branches/paris-sprint-2006/utils.py

Log:

- added a "web image" field for CSS

- reorganized some tests



Modified: cpsskins/branches/paris-sprint-2006/elements/interfaces.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/elements/interfaces.py  (original)
+++ cpsskins/branches/paris-sprint-2006/elements/interfaces.py  Sun May 21 
17:00:07 2006
@@ -60,6 +60,9 @@
 class IField(IElement):
     """A field element"""
 
+    def __str__(self):
+        """Return a string representation of the field"""
+
 class IDisplayable(Interface):
 
     def getDisplay(perspective, default):

Modified: cpsskins/branches/paris-sprint-2006/ftests/test_appsetup.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ftests/test_appsetup.py (original)
+++ cpsskins/branches/paris-sprint-2006/ftests/test_appsetup.py Sun May 21 
17:00:07 2006
@@ -53,6 +53,7 @@
     return unittest.TestSuite((
         FunctionalDocFileSuite('../setup/README.txt', setUp=setUp),
         FunctionalDocFileSuite('../setup/io/README.txt', setUp=setUp),
+        FunctionalDocFileSuite('../setup/fields.txt', setUp=setUp),
         ))
 
 if __name__ == '__main__':

Modified: cpsskins/branches/paris-sprint-2006/setup/README.txt
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/README.txt        (original)
+++ cpsskins/branches/paris-sprint-2006/setup/README.txt        Sun May 21 
17:00:07 2006
@@ -3,6 +3,9 @@
 APPLICATION SETUP
 =================
 
+Resources
+=========
+
 The application is set up by registering _resources_. Any application object 
can
 be registered as a resource.
 
@@ -83,8 +86,12 @@
     >>> resources.lookup(u'cpsskins://dummy:resource2') is None
     True
 
-Registering resources as settings
----------------------------------
+
+Settings
+========
+
+Registering settings
+--------------------
 
 Registered resources become *application settings*. Instead of accessing the
 resource directly (e.g. 'cpsskins://dummy:resource1') we access it by
@@ -120,7 +127,7 @@
     <Setting: cpsskins://[EMAIL PROTECTED]>
 
 
-Trying to unregister a global resource raises an error:
+Trying to unregister a global setting raises an error:
 
     >>> resources.isGlobal(u'cpsskins://[EMAIL PROTECTED]')
     True
@@ -246,8 +253,8 @@
     u'resource1'
 
 
-Registering settings from the filesystem
-----------------------------------------
+File-system settings
+--------------------
 
 Global settings can also be stored on the filesystem in gzipped TAR archives.
 
@@ -285,18 +292,15 @@
 </configure>
 
 
-IMPORT / EXPORT
-===============
+Classification of resources
+===========================
 
-To be exported and imported, resources must be uniformally identifiable.
+Resources must be uniformally identifiable.
 
 Their name is obtained by combining element type, resource type and content
 type names. Finally the resource's own identifier is used.
 
 
-Classification of resources
-===========================
-
 Resources are classified according to their "element type", "resource type"
 and "content type".
 
@@ -553,6 +557,7 @@
     >>> for k in root:
     ...     del root[k]
 
+
 Appendix
 ========
 

Added: cpsskins/branches/paris-sprint-2006/setup/fields.txt
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/setup/fields.txt        Sun May 21 
17:00:07 2006
@@ -0,0 +1,41 @@
+
+$Id$
+
+======
+FIELDS
+======
+
+Fields are typically registered as settings
+
+    >>> from zope.component import getUtility
+    >>> from cpsskins.setup.interfaces import IResourceManager, IIdentifiable
+
+    >>> resources = getUtility(IResourceManager)
+
+Web images
+----------
+
+    >>> from cpsskins.standard.fields.image import WebImage
+
+    >>> image1 = WebImage(title=u'blue background')
+    >>> image1.contentType = u'image/png'
+    >>> image1.data = "\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00x" \
+    ... "\x00\x00\x00x\x01\x03\x00\x00\x00\x03\xaa\xa4\x91\x00\x00\x00" \
+    ... "\x03PLTE\xff\xff\xff\xa7\xc4\x1b\xc8\x00\x00\x00\x17IDAT8\xcbc`" \
+    ... "\x18\x05\xa3`\x14\x8c\x82Q0\nF\x01\xbd\x01\x00\x07\x80\x00\x01:" \
+    ... "\xe7\xca\xd4\x00\x00\x00\x00IEND\xaeB`\x82"
+
+    >>> setting1 = resources.register(name=u'image1', title=u'Image 1',
+    ...                               resource=image1)
+
+    >>> uri = IIdentifiable(setting1).getURI()
+    >>> print uri
+    cpsskins://[EMAIL PROTECTED]
+
+
+Web colors
+----------
+
+    >>> from cpsskins.standard.fields.color import WebColor
+
+

Modified: cpsskins/branches/paris-sprint-2006/setup/io/README.txt
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/io/README.txt     (original)
+++ cpsskins/branches/paris-sprint-2006/setup/io/README.txt     Sun May 21 
17:00:07 2006
@@ -297,6 +297,8 @@
 Export of fields
 ----------------
 
+web colors:
+
     >>> from cpsskins.standard.fields.color import WebColor
     >>> blue = WebColor(r=0, g=0, b=255)
     >>> root[u'color-1'] = blue
@@ -313,3 +315,35 @@
     </colors>
     <BLANKLINE>
 
+web images:
+
+    >>> from cpsskins.standard.fields.image import WebImage
+
+    >>> image1 = WebImage(title=u'blue background')
+    >>> image1.contentType = u'image/png'
+    >>> image1.data = "\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00x" \
+    ... "\x00\x00\x00x\x01\x03\x00\x00\x00\x03\xaa\xa4\x91\x00\x00\x00" \
+    ... "\x03PLTE\xff\xff\xff\xa7\xc4\x1b\xc8\x00\x00\x00\x17IDAT8\xcbc`" \
+    ... "\x18\x05\xa3`\x14\x8c\x82Q0\nF\x01\xbd\x01\x00\x07\x80\x00\x01:" \
+    ... "\xe7\xca\xd4\x00\x00\x00\x00IEND\xaeB`\x82"
+
+    >>> root[u'image-1'] = image1
+
+    >>> archive = {}
+
+    >>> print toXML(image1, u'images', archive=archive)
+    <?xml version="1.0" encoding="utf-8"?>
+    <images>
+      <image id="...">
+        <data value="..._data_120x120.png"/>
+        <contentType value="image/png"/>
+      </image>
+    </images>
+    <BLANKLINE>
+
+
+Teardown:
+
+    >>> for k in root:
+    ...     del root[k]
+

Modified: cpsskins/branches/paris-sprint-2006/setup/manager.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/manager.py        (original)
+++ cpsskins/branches/paris-sprint-2006/setup/manager.py        Sun May 21 
17:00:07 2006
@@ -20,6 +20,7 @@
 import logging
 from copy import deepcopy
 
+from zope.app import zapi
 from zope.app.container.interfaces import INameChooser
 from zope.interface import implements
 
@@ -40,7 +41,7 @@
     def __init__(self, context=None):
         self.context = context
 
-    ### Registration of settings  #####################################
+    ### Registration of settings  ######################################
 
     def register(self, name=u'', title=u'', resource=None, filename=None,
                        custom=False, context=None):
@@ -113,9 +114,11 @@
             settings_dict[uri] = setting
         return settings_dict.values()
 
-    ### Resolving resources  ###########################################
+    ### Resolving URIs  ################################################
 
     def resolve(self, uri, context=None):
+        """Resolve the URI, return a resource.
+        """
         if not uri.startswith('cpsskins://'):
             raise ValueError("Unknown URI scheme in '%s'" % uri)
 
@@ -148,7 +151,14 @@
 
         return resource
 
-    ### Management  ################################################
+    ### Referring to resources  ########################################
+
+    def url(self, uri=u'', context=None):
+        mgr = getThemeManager(context)
+        path = zapi.getPath(mgr)
+        return path
+
+    ### Management  ####################################################
 
     def purge(self, context=None):
         for setting in self.list(context=context):
@@ -157,7 +167,7 @@
             uri = IIdentifiable(setting).getURI()
             self.unregister(uri=uri, context=context)
 
-    ### Customization  ################################################
+    ### Customization  #################################################
 
     def isGlobal(self, uri=u''):
         global_settings = getThemeManager().getSettings()

Modified: cpsskins/branches/paris-sprint-2006/standard/fields/color.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/fields/color.py        
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/fields/color.py        Sun May 
21 17:00:07 2006
@@ -25,7 +25,7 @@
 from cpsskins.elements.element import Element
 from cpsskins.elements.interfaces import IField
 
-class IColor(IField):
+class IWebColor(IField):
     """A web color."""
 
     rgb = Tuple(
@@ -41,10 +41,10 @@
         """RBG representation: rgb(123, 255, 200)
         """
 
-class Color(Persistent, Element):
+class WebColor(Persistent, Element):
     """A web color with red, green and blue components (0-255)
     """
-    implements(IColor)
+    implements(IWebColor)
 
     def __init__(self, r=0, g=0, b=0):
         self.rgb = r, g, b

Modified: cpsskins/branches/paris-sprint-2006/standard/fields/color.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/fields/color.zcml      
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/fields/color.zcml      Sun May 
21 17:00:07 2006
@@ -5,14 +5,14 @@
   <!-- Field -->
   <cpsskins:field
     name="color"
-    schema=".color.IColor"
-    class=".color.Color"
+    schema=".color.IWebColor"
+    class=".color.WebColor"
   />
 
   <cpsskins:setting
     name="color"
-    schema=".color.IColor"
-    class=".color.Color"
+    schema=".color.IWebColor"
+    class=".color.WebColor"
   />
 
 </configure>

Modified: cpsskins/branches/paris-sprint-2006/standard/fields/configure.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/fields/configure.zcml  
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/fields/configure.zcml  Sun May 
21 17:00:07 2006
@@ -1,7 +1,8 @@
 <configure
     xmlns="http://namespaces.zope.org/zope";>
 
-    <!-- Color -->
     <include file="color.zcml" />
 
+    <include file="image.zcml" />
+
 </configure>

Added: cpsskins/branches/paris-sprint-2006/standard/fields/image.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/standard/fields/image.py        Sun May 
21 17:00:07 2006
@@ -0,0 +1,72 @@
+##############################################################################
+#
+# 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 import zapi
+from zope.app.file.image import Image
+from zope.app.file.interfaces import IImage
+from zope.interface import implements
+from zope.i18nmessageid import MessageFactory
+from zope.schema import Bytes, BytesLine
+
+from cpsskins.elements.interfaces import IField
+
+_ = MessageFactory("cpsskins")
+
+class IWebImage(IImage, IField):
+    """A web image."""
+
+    data = Bytes(
+        title=_(u"Image data"),
+        description=_(u"The image data"),
+        default='',
+        missing_value='',
+        required=False,
+        )
+
+    contentType = BytesLine(
+        title = _(u"Content Type"),
+        default='',
+        required=False,
+        missing_value='',
+        readonly=True,
+        )
+
+    def toUrl(self):
+        """URL representation: url(...)
+        """
+        url = zapi.absoluteURL(self)
+        print url
+        return u'url(%s)' % url
+
+class WebImage(Image):
+    """A web image
+    """
+    implements(IWebImage)
+
+    def __init__(self, title=u'', **kw):
+        super(Image, self).__init__(**kw)
+        self.title = title
+
+    def __str__(self):
+        """See cpsskins.elements.interfaces.IField"""
+        return self.toUrl()
+
+    def toUrl(self):
+        return u''
+

Added: cpsskins/branches/paris-sprint-2006/standard/fields/image.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/standard/fields/image.zcml      Sun May 
21 17:00:07 2006
@@ -0,0 +1,18 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope";
+    xmlns:cpsskins="http://namespaces.zope.org/cpsskins";>
+
+  <!-- Field -->
+  <cpsskins:field
+    name="image"
+    schema=".image.IWebImage"
+    class=".image.WebImage"
+  />
+
+  <cpsskins:setting
+    name="image"
+    schema=".image.IWebImage"
+    class=".image.WebImage"
+  />
+
+</configure>

Added: cpsskins/branches/paris-sprint-2006/standard/filters/style/README.txt
==============================================================================
--- (empty file)
+++ cpsskins/branches/paris-sprint-2006/standard/filters/style/README.txt       
Sun May 21 17:00:07 2006
@@ -0,0 +1,70 @@
+
+$Id$
+
+=============
+CSS RENDERING
+=============
+
+    >>> from zope.app import zapi
+
+    >>> from zope.component import getGlobalSiteManager
+    >>> gsm = getGlobalSiteManager()
+
+    >>> from cpsskins.standard.filters.style import CSSRenderer
+    >>> from cpsskins.standard.filters.style import ICSSRenderer
+    >>> from cpsskins.standard.filters.style import StyleFilter
+    >>> from cpsskins.standard.formats.style import IStyle, Style
+
+    >>> s = Style()
+    >>> s.identifier = 12345
+
+inserting class names in HTML tags:
+
+    >>> f = StyleFilter(s)
+
+    >>> f(markup=u'<div>Some content</div>', info=None)
+    u'<div class="style12345">Some content</div>'
+
+    >>> f(markup=u'<div\n>Some content</div>', info=None)
+    u'<div class="style12345">Some content</div>'
+
+    >>> f(markup=u'<div style="color:red">Some content</div>', info=None)
+    u'<div style="color:red" class="style12345">Some content</div>'
+
+    >>> f(markup=u'<div style="color:red"><p>Some content</p></div>', 
info=None)
+    u'<div style="color:red" class="style12345"><p>Some content</p></div>'
+
+    >>> f(markup=u'<div style="color:red" class="box">A box</div>', info=None)
+    u'<div style="color:red" class="box style12345">A box</div>'
+
+    >>> f(markup=u'<p class="fancy blue" style="color:red">Text</p>', 
info=None)
+    u'<p style="color:red" class="fancy blue style12345">Text</p>'
+
+    >>> f(markup=u'<p style="color:red" class="fancy blue">Text</p>', 
info=None)
+    u'<p style="color:red" class="fancy blue style12345">Text</p>'
+
+rendering CSS:
+
+    >>> s = Style()
+    >>> s.identifier = 12345
+    >>> s[u'div.body'] = {'color': 'red'}
+
+    >>> r = CSSRenderer(s)
+    >>> r()
+    u'div.body.style12345  {color:red}'
+
+    >>> s[u'ul'] = {'border': u'none', 'color': u'red'}
+    >>> r = CSSRenderer(s)
+    >>> r()
+    u'div.body.style12345  {color:red}\nul.style12345  {color:red;border:none}'
+
+    >>> s[u'ul'] = {}
+
+    >>> s[u''] = {'color': u'red'}
+    >>> r = CSSRenderer(s)
+    >>> r()
+    u'.style12345  {color:red}\ndiv.body.style12345  {color:red}'
+
+    >>> s[u'p'] = {'color': 'cpsskins://[EMAIL PROTECTED]'}
+    >>> r = CSSRenderer(s)
+    >>> r()

Modified: cpsskins/branches/paris-sprint-2006/standard/filters/style/__init__.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/filters/style/__init__.py      
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/filters/style/__init__.py      
Sun May 21 17:00:07 2006
@@ -21,10 +21,12 @@
 from zope.component import adapts, getUtility
 
 from cpsskins import utils
-from cpsskins.standard.formats.style import IStyle
 from cpsskins.browser.rendering.interfaces import IFilterView
 from cpsskins.relations.interfaces import IRelatable
 from cpsskins.setup.interfaces import IResourceManager, IIdentifiable
+from cpsskins.standard.fields.color import IWebColor
+from cpsskins.standard.fields.image import IWebImage
+from cpsskins.standard.formats.style import IStyle
 
 class ICSSRenderer(Interface):
     """Renders a style in CSS"""
@@ -34,40 +36,6 @@
     some HTML markup. The CSS class name is obtained from the adapted object
     (e.g. a Style Format element)
 
-    >>> from zope.app.testing import ztapi
-    >>> from zope.app import zapi
-    >>> gsm = zapi.getGlobalSiteManager()
-
-    >>> gsm.registerAdapter(CSSRenderer, (IStyle,), ICSSRenderer)
-
-    >>> from cpsskins.standard.formats.style import Style
-
-    >>> s = Style()
-    >>> s.identifier = 12345
-
-    >>> f = StyleFilter(s)
-
-    >>> f(markup=u'<div>Some content</div>', info=None)
-    u'<div class="style12345">Some content</div>'
-
-    >>> f(markup=u'<div\\n>Some content</div>', info=None)
-    u'<div class="style12345">Some content</div>'
-
-    >>> f(markup=u'<div style="color:red">Some content</div>', info=None)
-    u'<div style="color:red" class="style12345">Some content</div>'
-
-    >>> f(markup=u'<div style="color:red"><p>Some content</p></div>', 
info=None)
-    u'<div style="color:red" class="style12345"><p>Some content</p></div>'
-
-    >>> f(markup=u'<div style="color:red" class="box">A box</div>', info=None)
-    u'<div style="color:red" class="box style12345">A box</div>'
-
-    >>> f(markup=u'<p class="fancy blue" style="color:red">Text</p>', 
info=None)
-    u'<p style="color:red" class="fancy blue style12345">Text</p>'
-
-    >>> f(markup=u'<p style="color:red" class="fancy blue">Text</p>', 
info=None)
-    u'<p style="color:red" class="fancy blue style12345">Text</p>'
-
     """
 
     adapts(IStyle)
@@ -84,35 +52,6 @@
 class CSSRenderer(object):
     """Render a style in CSS
 
-    >>> from zope.app import zapi
-
-    >>> from cpsskins.standard.formats.style import Style
-    >>> from cpsskins.setup.interfaces import IResourceManager
-    >>> from cpsskins.setup.manager import ResourceManager
-
-    >>> gsm = zapi.getGlobalSiteManager()
-    >>> gsm.registerUtility(ResourceManager(), IResourceManager)
-
-    >>> s = Style()
-    >>> s.identifier = 12345
-    >>> s[u'div.body'] = {'color': 'red'}
-
-    >>> r = CSSRenderer(s)
-    >>> r()
-    u'div.body.style12345  {color:red}'
-
-    >>> s[u'ul'] = {'border': u'none', 'color': u'red'}
-    >>> r = CSSRenderer(s)
-    >>> r()
-    u'div.body.style12345  {color:red}\\nul.style12345  
{color:red;border:none}'
-
-    >>> s[u'ul'] = {}
-
-    >>> s[u''] = {'color': u'red'}
-    >>> r = CSSRenderer(s)
-    >>> r()
-    u'.style12345  {color:red}\\ndiv.body.style12345  {color:red}'
-
     """
     adapts(IStyle)
     implements(ICSSRenderer)
@@ -131,6 +70,8 @@
         rendered = []
 
         resources = getUtility(IResourceManager)
+        isWebColor = IWebColor.providedBy
+        isWebImage = IWebImage.providedBy
 
         for k, v in style.items():
             s = k.split(' ')
@@ -138,12 +79,16 @@
             if not v:
                 continue
             props = []
-            for p, r in v.items():
-                if r.startswith('cpsskins://'):
-                    r = resources.resolve(r, context)
-                if not r:
+            for p, q in v.items():
+                if q.startswith('cpsskins://'):
+                    r = resources.resolve(q, context)
+                    if isWebColor(r):
+                        q = str(r)
+                    elif isWebImage(r):
+                        q = resources.url(uri, context)
+                if not q:
                     continue
-                props.append('%s:%s' % (p, r))
+                props.append('%s:%s' % (p, q))
             rendered.append('%s.%s %s {%s}' % (s[0], style_id, sel,
                                               ';'.join(props)))
         return '\n'.join(rendered)

Modified: cpsskins/branches/paris-sprint-2006/tests/setup.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/tests/setup.py  (original)
+++ cpsskins/branches/paris-sprint-2006/tests/setup.py  Sun May 21 17:00:07 2006
@@ -36,11 +36,16 @@
 from cpsskins.relations.tool import RelationTool
 from cpsskins.relations.storage import RelationStorage
 from cpsskins.setup.adapters import Type, Identifiable
-from cpsskins.setup.interfaces import IType, IIdentifiable
+from cpsskins.setup.interfaces import IType, IIdentifiable, IResourceManager
+from cpsskins.setup.manager import ResourceManager
+from cpsskins.standard.filters.style import CSSRenderer, ICSSRenderer
+from cpsskins.standard.formats.style import IStyle
 from cpsskins.thememanager import IThemeManagementFolder, ThemeManagementFolder
 
 def setUp(test):
     gsm = zapi.getGlobalSiteManager()
+
+    # adapters
     gsm.registerAdapter(Formattable, (IDisplay,), IPathAdapter, 'formattable')
     gsm.registerAdapter(Displayable, (IElement,), IPathAdapter, 'displayable')
     gsm.registerAdapter(RelationTool, (IElement,), IRelationTool)
@@ -50,7 +55,15 @@
     gsm.registerAdapter(perspective.Relatable, (IPerspective,), IRelatable)
 
     gsm.registerAdapter(RelationStorage, (None,), IRelationStorage)
+    gsm.registerAdapter(CSSRenderer, (IStyle,), ICSSRenderer)
+
+    # utilities
     gsm.registerUtility(RelationStorage(), IRelationStorage)
+    gsm.registerUtility(ResourceManager(), IResourceManager)
+
+    gtmutil = ThemeManagementFolder()
+    gtmutil.registerUtilities()
+    gsm.registerUtility(gtmutil, IThemeManagementFolder)
 
     setup.setUpSiteManagerLookup()
 

Modified: cpsskins/branches/paris-sprint-2006/tests/test_filters.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/tests/test_filters.py   (original)
+++ cpsskins/branches/paris-sprint-2006/tests/test_filters.py   Sun May 21 
17:00:07 2006
@@ -19,7 +19,7 @@
 
 import unittest
 
-from zope.testing.doctestunit import DocTestSuite
+from zope.testing.doctestunit import DocTestSuite, DocFileSuite
 
 from cpsskins.tests.setup import setUp
 
@@ -33,6 +33,7 @@
                      setUp=setUp),
         DocTestSuite('cpsskins.standard.filters.accesskeys',
                      setUp=setUp),
+        DocFileSuite('../standard/filters/style/README.txt', setUp=setUp)
         ))
 
 if __name__ == '__main__':

Modified: cpsskins/branches/paris-sprint-2006/utils.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/utils.py        (original)
+++ cpsskins/branches/paris-sprint-2006/utils.py        Sun May 21 17:00:07 2006
@@ -33,9 +33,8 @@
     if context is None:
         gsm = getGlobalSiteManager()
         mgr = gsm.queryUtility(IThemeManagementFolder, name=name)
-        if mgr is None:
-            raise ValueError("No global theme management folder was found.")
-        return mgr
+        if mgr is not None:
+            return mgr
 
     # local utility
     sm = getSiteManager(context)
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to