Author: jmorliaguet
Date: Thu Jun  8 22:52:00 2006
New Revision: 3364

Modified:
   
cpsskins/branches/paris-sprint-2006/standard/screens/styleeditor/configure.zcml
   cpsskins/branches/paris-sprint-2006/standard/screens/styleeditor/views.py

Log:

- cleanup



Modified: 
cpsskins/branches/paris-sprint-2006/standard/screens/styleeditor/configure.zcml
==============================================================================
--- 
cpsskins/branches/paris-sprint-2006/standard/screens/styleeditor/configure.zcml 
    (original)
+++ 
cpsskins/branches/paris-sprint-2006/standard/screens/styleeditor/configure.zcml 
    Thu Jun  8 22:52:00 2006
@@ -33,6 +33,13 @@
         attribute="setFormData"
     />
 
+  </browser:pages>
+
+  <browser:pages
+      for="cpsskins.standard.formats.style.IStyle"
+      class=".views.StyleEditor"
+      permission="zope.ManageContent">
+
     <browser:page
         name="getStyleData"
         attribute="getStyleData"

Modified: 
cpsskins/branches/paris-sprint-2006/standard/screens/styleeditor/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/screens/styleeditor/views.py   
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/screens/styleeditor/views.py   
Thu Jun  8 22:52:00 2006
@@ -27,7 +27,6 @@
 from cpsskins.browser.negotiation.interfaces import INegotiation
 from cpsskins.clientstorage import ClientStorage
 from cpsskins.elements.interfaces import IDisplayable, IFormattable
-from cpsskins.setup.interfaces import IResourceManager
 from cpsskins.utils import getThemeManager
 
 cache = RAMCache()
@@ -50,7 +49,7 @@
         perspective = negotiation.getPerspective()
         displayable = IDisplayable(element)
         display = displayable.getEffectiveDisplay(perspective)
-        widget = IFormattable(display).getFormat(u'widget')
+        widget = IFormattable(display).getFormat('widget')
         return widget.types
 
     def renderWidgetPreview(self):
@@ -127,21 +126,20 @@
 
     def setFormData(self):
         data = self.data
-        selector = data.get(u'selector')
+        style_data = self.style_data
+        selector = data.get('selector')
         if selector is None:
             raise ValueError("The CSS selector is not set.")
-        style_id = data.get(u'style_id')
+        style_id = style_data['style_id']
         if not style_id:
             raise ValueError("The style id is not set.")
         style = self.tmutil.getElementById(style_id)
-
         props = {}
         for name in self.getFieldNames():
             value = self.request.form.get(name)
             if value is None:
                 continue
             props[name] = value
-
         style[selector] = props
 
     def getFieldNames(self):
@@ -158,18 +156,12 @@
 
     def getStyleData(self):
         data = self.data
-        widget = self.style_data[u'widget']
-        style_id = self.style_data[u'style_id']
-        selector = data.get(u'selector', u'')
-        resources = getUtility(IResourceManager)
-
+        selector = data.get('selector', u'')
         data = {
-            'widget': widget,
-            'style_id': style_id,
             'selector': selector,
             'fields': [],
         }
-
+        style_id = self.style_data['style_id']
         if style_id and selector:
             style = self.tmutil.getElementById(style_id)
             fields = []
@@ -184,9 +176,7 @@
                     'disabled': False,
                     'status': u'',
                 })
-
             data['fields'] = fields
-
         self.request.response.setHeader('content-type', 'text/x-json')
         return json.write(data)
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to