[Zope3-checkins] CVS: Zope3/src/zope/app/browser/content - fssync.py:1.5

Guido van Rossum guido@python.org
Thu, 8 May 2003 16:41:03 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/content
In directory cvs.zope.org:/tmp/cvs-serv4403

Modified Files:
	fssync.py 
Log Message:
Allow an alternate way of uploading the zip file, as the body of the
request with Content-Type set to application/zip.


=== Zope3/src/zope/app/browser/content/fssync.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/content/fssync.py:1.4	Thu May  8 15:53:55 2003
+++ Zope3/src/zope/app/browser/content/fssync.py	Thu May  8 16:41:02 2003
@@ -115,13 +115,17 @@
     """
 
     def update(self):
-        zipfile = self.request.get("zipfile")
-        if zipfile is None:
-            return # Not updating -- must be presenting a blank form
-        zipfiledata = zipfile.read()
+        if self.request.getHeader("Content-Type") == "application/zip":
+            zipfiledata = self.request.body
+        else:
+            zipfile = self.request.get("zipfile")
+            if zipfile is None:
+                return # Not updating -- must be presenting a blank form
+            else:
+                zipfiledata = zipfile.read()
         # 00) Allocate temporary names
         topdir = tempfile.mktemp()
-        zipfilename = os.path.join(topdir, zipfile.filename)
+        zipfilename = os.path.join(topdir, "working.zip")
         working = os.path.join(topdir, "working")
         current = os.path.join(topdir, "current")
         try: