Author: jmorliaguet
Date: Sun Nov 20 11:26:26 2005
New Revision: 1902

Modified:
   cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py
   cpsskins/branches/jmo-perspectives/engines/sitedesigner/configure.zcml
   cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.pt
Log:

- added a method to export resources in XML



Modified: cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py  
(original)
+++ cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py  Sun Nov 
20 11:26:26 2005
@@ -20,7 +20,9 @@
 from zope.app.publisher.browser import BrowserView
 from zope.component import getUtilitiesFor, getUtility
 from zope.app.interface import queryType
+from zope import xmlpickle 
 
+from cpsskins.configuration.interfaces import IResource
 from cpsskins.interfaces import ISettings, ISetting, ISettingType
 from cpsskins.resources.manager import IResourceManager
 
@@ -38,7 +40,6 @@
         return info
 
     def customizeSetting(self, name=u''):
-        """ """
         if not name:
             raise KeyError("Must specify a setting's name.")
 
@@ -48,3 +49,17 @@
 
         target = self.request.get('HTTP_REFERER', '.')
         self.request.response.redirect(target)
+
+    def exportResource(self, name=u''):
+        """Export the resource as XML.
+        """
+        if not name:
+            raise KeyError("Must specify a setting's name.")
+
+        setting =  getUtility(ISetting, name)
+        resource = IResource(setting).getResource()
+
+        response = self.request.response
+        response.setHeader('content-type', 'text/xml')
+        return xmlpickle.dumps(resource)
+

Modified: cpsskins/branches/jmo-perspectives/engines/sitedesigner/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/sitedesigner/configure.zcml      
(original)
+++ cpsskins/branches/jmo-perspectives/engines/sitedesigner/configure.zcml      
Sun Nov 20 11:26:26 2005
@@ -40,6 +40,11 @@
         attribute="customizeSetting"
     />
 
+    <page
+        name="exportResource"
+        attribute="exportResource"
+    />
+
   </pages>
 
 </configure>

Modified: 
cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.pt    
(original)
+++ cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.pt    
Sun Nov 20 11:26:26 2005
@@ -47,9 +47,10 @@
             <ul tal:define="setting_info context/@@getSettingInfo">
               <li tal:repeat="info setting_info/?subsection|nothing">
                 <tal:block content="info/setting/title" />
-                <a tal:define="name info/name"
-                   tal:attributes="href string:@@customizeSetting?name=$name"
-                   tal:condition="info/setting/readonly">[customize]</a>
+                <tal:block define="name info/name">
+                  <a tal:attributes="href string:@@customizeSetting?name=$name"
+                     tal:condition="info/setting/readonly">[customize]</a>
+                </tal:block>
               </li>
             </ul>
             </div>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to