Rev 57: Get rid of the APPEND experiments, this is not going to be supported anytime soon. in http://bazaar.launchpad.net/%7Ebzr/bzr.webdav/webdav

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jun 9 09:14:52 BST 2008


At http://bazaar.launchpad.net/%7Ebzr/bzr.webdav/webdav

------------------------------------------------------------
revno: 57
revision-id: v.ladeuil+lp at free.fr-20080609081450-xvf1ilxvwdvf9st5
parent: v.ladeuil+lp at free.fr-20080609080217-73bsl8r1x7b19fut
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: webdav
timestamp: Mon 2008-06-09 10:14:50 +0200
message:
  Get rid of the APPEND experiments, this is not going to be supported anytime soon.
modified:
  TODO                           todo-20060820113924-ioaocfzvsb4wq9z1-1
  tests/dav_server.py            dav_server.py-20080609075311-lfywqma6p6uijow7-1
  webdav.py                      webdav.py-20060816232542-enpjxth2743ttqpq-3
-------------- next part --------------
=== modified file 'TODO'
--- a/TODO	2008-06-09 08:02:17 +0000
+++ b/TODO	2008-06-09 08:14:50 +0000
@@ -6,9 +6,6 @@
 
 * webdav.py
 
-** get rid of the APPEND experiments, this is not going to be
-   supported anytime soon.
-
 ** We can detect that the server do not accept "write" operations
    (it will return 501) and raise InvalidHttpRequest(to be
    defined as a daughter of InvalidHttpResponse) but what will

=== modified file 'tests/dav_server.py'
--- a/tests/dav_server.py	2008-06-09 08:02:17 +0000
+++ b/tests/dav_server.py	2008-06-09 08:14:50 +0000
@@ -304,47 +304,6 @@
             self.send_response(201)
             self.end_headers()
 
-class TestingDAVAppendRequestHandler(TestingDAVRequestHandler):
-    """
-    Subclass of TestingDAVRequestHandler implementing te APPEND command.
-
-    http://www.ietf.org/internet-drafts/draft-suma-append-patch-00.txt
-    propose two new commands: APPEND and PATCH. Their description
-    is sparse, this is a best effort attempt to implement the
-    APPEND command.
-    """
-    def do_APPEND(self):
-        """Serve an APPEND request"""
-        path = self.translate_path(self.path)
-        trace.mutter("do_APPEND rel: [%s], abs: [%s]" % (self.path,path))
-
-        if self.headers.get('Expect') == '100-continue':
-            # Tell the client to go ahead, we're ready to get the content
-            self.send_response(100,"Continue")
-            self.end_headers()
-
-        try:
-            # Always write in binary mode.
-            trace.mutter("do_APPEND will try to open: [%s]" % path)
-            f = open(path, 'wb+')
-        except (IOError, OSError), e :
-            self.send_error(409, "Conflict")
-            return
-
-        try:
-            data = self.read_body()
-            f.write(data)
-        except (IOError, OSError):
-            # FIXME: We leave a partially updated file here
-            self.send_error(409, "Conflict")
-            f.close()
-            return
-        f.close()
-        trace.mutter("do_APPEND done: [%s]" % self.path)
-        # FIXME: We should send 204 if the file didn't exist before
-        self.send_response(201)
-        self.end_headers()
-
 
 class DAVServer(http_server.HttpServer):
     """Subclass of HttpServer that gives http+webdav urls.
@@ -362,25 +321,6 @@
     _url_protocol = 'http+webdav'
 
 
-class DAVServer_append(DAVServer):
-    """Subclass of HttpServer that gives http+webdav urls.
-
-    This is for use in testing: connections to this server will always go
-    through pycurl where possible.
-    This server implements the proposed
-    (www.ietf.org/internet-drafts/draft-suma-append-patch-00.txt)
-    APPEND request.
-    """
-
-    def __init__(self):
-        # We    have   special    requests    to   handle    that
-        # HttpServer_PyCurl don't know about
-        super(DAVServer_append,self).__init__(TestingDAVAppendRequestHandler)
-
-    # urls returned by this server should require the webdav client impl
-    _url_protocol = 'http+webdav'
-
-
 class TestCaseWithDAVServer(tests.TestCaseWithTransport):
     """A support class that provides urls that are http+webdav://.
 

=== modified file 'webdav.py'
--- a/webdav.py	2008-06-09 08:02:17 +0000
+++ b/webdav.py	2008-06-09 08:14:50 +0000
@@ -652,7 +652,7 @@
 
         Note that when a non-empty dir required to be deleted, a conforming DAV
         server will delete the dir and all its content. That does not normally
-        append in bzr.
+        happen in bzr.
         """
         abs_path = self._remote_path(rel_path)
 
@@ -790,11 +790,6 @@
             if not is_dir:
                 yield name
 
-    # TODO: Before
-    # www.ietf.org/internet-drafts/draft-suma-append-patch-00.txt
-    # becomes  a real  RFC and  gets implemented,  we can  try to
-    # implement   it   in   a   test  server.   Below   are   two
-    # implementations, a third one will correspond to the draft.
     def append_file(self, relpath, f, mode=None):
         """See Transport.append_file"""
         return self.append_bytes(relpath, f.read(), mode=mode)
@@ -867,8 +862,4 @@
 def get_test_permutations():
     """Return the permutations to be used in testing."""
     import tests.dav_server
-    return [(HttpDavTransport, tests.dav_server.DAVServer),
-            # Until the Dav transport try to use the APPEND
-            # request, there is no need to activate the following
-            # (HttpDavTransport, test_webdav.DAVServer_append),
-            ]
+    return [(HttpDavTransport, tests.dav_server.DAVServer),]



More information about the bazaar-commits mailing list