[FIX] document_webdav: make sure the headers is a dict.
authorVo Minh Thu <vmt@openerp.com>
Thu, 8 Sep 2011 09:44:38 +0000 (11:44 +0200)
committerVo Minh Thu <vmt@openerp.com>
Thu, 8 Sep 2011 09:44:38 +0000 (11:44 +0200)
bzr revid: vmt@openerp.com-20110908094438-rpqz2k5xn0pmhigx

addons/document_webdav/webdav_server.py

index e23daab..e92c7f1 100644 (file)
@@ -174,11 +174,11 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler):
             pass
         elif self.close_connection == 1: # close header already sent
             pass
-        else:
-            if headers is None:
-                headers = {}
-            if self.headers.get('Connection',False) == 'Keep-Alive':
-                headers['Connection'] = 'keep-alive'
+        elif headers and self.headers.get('Connection',False) == 'Keep-Alive':
+            headers['Connection'] = 'keep-alive'
+
+        if headers is None:
+            headers = {}
 
         DAVRequestHandler.send_body(self, DATA, code=code, msg=msg, desc=desc,
                     ctype=ctype, headers=headers)