Author: jmorliaguet
Date: Mon Jul  3 10:50:43 2006
New Revision: 3600

Modified:
   cpsskins/branches/paris-sprint-2006/setup/snapshot.py
   cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/io_section.pt
   cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py

Log:

- using the snapshot's filename instead of the id



Modified: cpsskins/branches/paris-sprint-2006/setup/snapshot.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/snapshot.py       (original)
+++ cpsskins/branches/paris-sprint-2006/setup/snapshot.py       Mon Jul  3 
10:50:43 2006
@@ -20,13 +20,19 @@
 import time
 
 from zope.app.container.contained import Contained
-from zope.interface import implements
 from zope.app.file import File
 from zope.app.file.interfaces import IFile
+from zope.interface import implements
+from zope.schema import TextLine
 
 class ISnapshot(IFile):
     """A site snapshot"""
 
+    filename = TextLine(
+        title=u"Filename",
+        description=u"The snapshot's filename",
+    )
+
     def read():
         """Return the file's data"""
 

Modified: 
cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/io_section.pt
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/io_section.pt    
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/io_section.pt    
Mon Jul  3 10:50:43 2006
@@ -1,6 +1,7 @@
 <div class="sections"
      tal:define="section request/form/section|nothing;
-                 snapshot request/form/snapshot|nothing">
+                 snapshot request/form/snapshot|nothing;
+                 snapshots context/@@listSnapshots">
   <div tal:condition="section">
 
     <div tal:condition="python: section == 'export'">
@@ -29,8 +30,11 @@
       <form action="@@importSnapshot" method="post"
             enctype="multipart/form-data">
         <select name="filename">
-          <option tal:repeat="snapshot context/@@listSnapshots"
-            tal:content="snapshot" />
+          <tal:block tal:repeat="id snapshots">
+            <option tal:define="snapshot snapshots/?id"
+                    tal:attributes="value id"
+                    tal:content="snapshot/filename" />
+          </tal:block>
         </select>
         <button type="submit">Load</button>
       </form>
@@ -49,9 +53,11 @@
       </form>
 
       <ul>
-        <li tal:repeat="snapshot context/@@listSnapshots">
-          <a tal:attributes="href string:@@downloadSnapshot?filename=$snapshot"
-             tal:content="snapshot" />
+        <li tal:repeat="id snapshots">
+          <a tal:define="snapshot snapshots/?id;
+                         filename snapshot/filename"
+             tal:attributes="href 
string:@@downloadSnapshot?id=$id&filename=$filename"
+             tal:content="filename" />
         </li>
       </ul>
     </div>

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py 
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Mon Jul 
 3 10:50:43 2006
@@ -117,9 +117,9 @@
             }})
 
     def listSnapshots(self):
-        return list(self.getSnapshotStorage())
+        return dict(self.getSnapshotStorage())
 
-    def downloadSnapshot(self, filename=u''):
+    def downloadSnapshot(self, id=u'', filename=u''):
         if not filename:
             raise ValueError("No snaphost filename specified.")
 
@@ -129,7 +129,7 @@
                            'attachment; filename=%s' % filename)
 
         snapshots = self.getSnapshotStorage()
-        return snapshots[filename].read()
+        return snapshots[id].read()
 
     def importSnapshot(self, filename=u''):
         if not filename:
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to