Rev 37: Add support for open_write_stream. in file:///v/home/vila/src/plugins/webdav/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Sep 17 09:10:58 BST 2007


At file:///v/home/vila/src/plugins/webdav/

------------------------------------------------------------
revno: 37
revision-id: v.ladeuil+lp at free.fr-20070917081057-3ugmhzecgd3yucl1
parent: v.ladeuil+lp at free.fr-20070917074623-71o26lu655q7tcyq
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: webdav
timestamp: Mon 2007-09-17 10:10:57 +0200
message:
  Add support for open_write_stream.
  
  * webdav.py:
  (HttpDavTransport.open_write_stream): Quick and dirty and sucking
  and copy/pasted implementation.
  
  * __init__.py: 
  Bumps required version to 0.92.
modified:
  __init__.py                    __init__.py-20060816232542-enpjxth2743ttqpq-2
  webdav.py                      webdav.py-20060816232542-enpjxth2743ttqpq-3
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2007-07-22 19:44:23 +0000
+++ b/__init__.py	2007-09-17 08:10:57 +0000
@@ -24,11 +24,11 @@
 import bzrlib
 major, minor, micro, releaselevel = bzrlib.version_info[:4]
 
-if major != 0 or minor < 19:
-    # We need bzr 0.19
+if major != 0 or minor < 92:
+    # We need bzr 0.92
     from bzrlib import trace
     trace.note('not installing http+webdav:// support'
-               ' (only supported for bzr 0.19 and above)')
+               ' (only supported for bzr 0.92 and above)')
 else:
     from bzrlib.transport import (
         register_lazy_transport

=== modified file 'webdav.py'
--- a/webdav.py	2007-09-17 07:46:23 +0000
+++ b/webdav.py	2007-09-17 08:10:57 +0000
@@ -203,6 +203,15 @@
         if code == 404:
             raise errors.NoSuchFile(abspath)
 
+    def open_write_stream(self, relpath, mode=None):
+        """See Transport.open_write_stream."""
+        # FIXME: this implementation sucks, we should really use chunk encoding
+        # and buffers.
+        self.put_bytes(relpath, "", mode)
+        result = transport.AppendBasedFileStream(self, relpath)
+        transport._file_streams[self.abspath(relpath)] = result
+        return result
+
     def put_file(self, relpath, f, mode=None):
         """See Transport.put_file"""
         return self.put_bytes(relpath, f.read(), mode=None)



More information about the bazaar-commits mailing list