Author: jmorliaguet
Date: Mon May 15 00:26:57 2006
New Revision: 3134

Modified:
   cpsskins/branches/paris-sprint-2006/standard/filters/style/css.py
   cpsskins/branches/paris-sprint-2006/ui/editing/views.py

Log:

- fixes



Modified: cpsskins/branches/paris-sprint-2006/standard/filters/style/css.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/filters/style/css.py   
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/filters/style/css.py   Mon May 
15 00:26:57 2006
@@ -23,7 +23,7 @@
 from cpsskins.standard.formats.storage import IFormatStorage
 from cpsskins.standard.formats.style import IStyle
 from cpsskins.standard.filters.style import ICSSRenderer
-from cpsskins.setup.interfaces import ISetting, IResource
+from cpsskins.setup.interfaces import ISetting, IResource, IResourceManager
 from cpsskins.utils import getThemeManager
 
 class IStylesheetView(Interface):
@@ -44,21 +44,18 @@
         """Render the styles in CSS
         """
         formats = getThemeManager(self.context).getFormatStorage()
+        resources = getUtility(IResourceManager)
         isStyle = IStyle.providedBy
 
-        response = self.request.response
-        response.setHeader('Content-Type', 'text/css')
-
-        # TODO: to cache or to optimize
-        resources = list(formats.values())
-        for name, setting in getUtilitiesFor(ISetting):
+        styles = [f for f in formats.values() if isStyle(f)]
+        for setting in resources.list(type=IStyle, context=self.context):
             resource = IResource(setting).getResource()
-            resources.append(resource)
+            styles.append(resource)
 
         rendered = []
-        for v in resources:
-            if not isStyle(v):
-                continue
-            rendered.append(ICSSRenderer(v)())
+        for s in styles:
+            rendered.append(ICSSRenderer(s)())
+
+        self.request.response.setHeader('Content-Type', 'text/css')
         return '\n'.join(rendered)
 

Modified: cpsskins/branches/paris-sprint-2006/ui/editing/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/editing/views.py     (original)
+++ cpsskins/branches/paris-sprint-2006/ui/editing/views.py     Mon May 15 
00:26:57 2006
@@ -218,7 +218,10 @@
         container = getParent(context)
         if not IStorage.providedBy(container):
             raise TypeError("The element is not located in a storage.")
+
         resource = locationCopy(removeSecurityProxy(context))
+        getThemeManager(context).registerElement(resource)
+
         resources = getUtility(IResourceManager)
         resources.register(title=title, resource=resource, context=context)
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to