Author: jmorliaguet
Date: Mon Dec  5 23:01:04 2005
New Revision: 1962

Modified:
   cpsskins/branches/jmo-perspectives/browser/editing/manage_settings.pt
   cpsskins/branches/jmo-perspectives/browser/editing/views.py
   cpsskins/branches/jmo-perspectives/setup/resources.py
   cpsskins/branches/jmo-perspectives/setup/settings.py
   cpsskins/branches/jmo-perspectives/storage/storage.py
Log:

- functional implementation of settings



Modified: cpsskins/branches/jmo-perspectives/browser/editing/manage_settings.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/editing/manage_settings.pt       
(original)
+++ cpsskins/branches/jmo-perspectives/browser/editing/manage_settings.pt       
Mon Dec  5 23:01:04 2005
@@ -3,15 +3,19 @@
     <div class="editArea">
       <h1>Manage settings</h1>
 
-      <p>This format uses a setting, in order to modify it you will need to
-         create a local copy.</p>
+      <p>This format currently uses a setting.</p>
 
       <h2>Edit this setting</h2>
       <ul>
-        <li>Create a local copy</li>
+        <li>Edit directly</li>
       </ul>
 
-      <h2>Use other settings</h2>
+      <h2>Customize this setting</h2>
+      <ul>
+        <li>Customize</li>
+      </ul>
+
+      <h2>Switch to another setting</h2>
       <ul tal:define="setting_info context/@@getSettingInfo;
                       format_type request/form/format|string:''">
         <li tal:condition="python: format_type in setting_info"

Modified: cpsskins/branches/jmo-perspectives/browser/editing/views.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/editing/views.py (original)
+++ cpsskins/branches/jmo-perspectives/browser/editing/views.py Mon Dec  5 
23:01:04 2005
@@ -17,11 +17,9 @@
 """
 __docformat__ = "reStructuredText"
 
-from zope.app.location.pickling import locationCopy
 from zope.app.location.traversing import LocationPhysicallyLocatable
 from zope.app.publisher.browser import BrowserView
-from zope.app.traversing.api import getParent
-from zope.app.zapi import queryMultiAdapter, getMultiAdapter
+from zope.app.zapi import queryMultiAdapter, getMultiAdapter, getParent
 from zope.component import adapts, queryUtility, getUtility
 from zope.interface import implements, Interface
 from zope.security.proxy import removeSecurityProxy
@@ -34,6 +32,7 @@
 from cpsskins.relations.interfaces import IRelationTool
 from cpsskins.relations.relations import DyadicRelation
 from cpsskins.setup.interfaces import IResourceManager, IResource, ISetting
+from cpsskins.storage.interfaces import IStorage
 
 #######################################################################
 # Generic views
@@ -189,9 +188,14 @@
     def createSetting(self, title=u''):
         """Create a setting from the context.
         """
-        resource = locationCopy(removeSecurityProxy(self.context))
+        context = self.context
+        container = getParent(context)
+        if not IStorage.providedBy(container):
+            raise TypeError("The element is not located in a storage.")
+        resource = container.duplicate(removeSecurityProxy(context))
+        resource = removeSecurityProxy(resource)
         resources = IResourceManager(resource)
-        resources.register(title=title, resource=resource, 
context=self.context)
+        resources.register(title=title, resource=resource, context=context)
         target = self.request.get('HTTP_REFERER', '.')
         self.request.response.redirect(target)
 

Modified: cpsskins/branches/jmo-perspectives/setup/resources.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/setup/resources.py       (original)
+++ cpsskins/branches/jmo-perspectives/setup/resources.py       Mon Dec  5 
23:01:04 2005
@@ -54,7 +54,8 @@
             settings = getUtility(ISettings, context=context)
             chooser = INameChooser(settings)
             name = name or chooser.chooseName(title, object)
-            settings[name] = factory(title=title, resource=resource)
+            setting = factory(title=title, resource=resource)
+            settings[name] = setting
 
             reg = UtilityRegistration(name, self.setting_type, settings[name])
             settings.registrationManager.addRegistration(reg)

Modified: cpsskins/branches/jmo-perspectives/setup/settings.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/setup/settings.py        (original)
+++ cpsskins/branches/jmo-perspectives/setup/settings.py        Mon Dec  5 
23:01:04 2005
@@ -46,6 +46,6 @@
         self.context = context
 
     def __str__(self):
-        return str(self.context.resource)
+        return str(self.context.title)
 
 

Modified: cpsskins/branches/jmo-perspectives/storage/storage.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/storage/storage.py       (original)
+++ cpsskins/branches/jmo-perspectives/storage/storage.py       Mon Dec  5 
23:01:04 2005
@@ -70,6 +70,7 @@
         new_name = chooser.chooseName(name, copy)
 
         notify(ObjectCopiedEvent(copy))
+        notify(ObjectAddedEvent(copy))
         self[new_name] = copy
 
         return self[new_name]
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to