Explorar el Código

Do not return error when file copy is not necessary + log

Guénaël Muller hace 6 años
padre
commit
c9d575647d
Se han modificado 1 ficheros con 16 adiciones y 2 borrados
  1. 16 2
      tracim/tracim/lib/webdav/__init__.py

+ 16 - 2
tracim/tracim/lib/webdav/__init__.py Ver fichero

@@ -6,6 +6,7 @@ from wsgidav import compat
6 6
 
7 7
 from tracim.lib.content import ContentApi
8 8
 from tracim.lib.utils import SameValueError
9
+from tracim.lib.base import logger
9 10
 from tracim.model import new_revision
10 11
 from tracim.model.data import ActionDescription
11 12
 from tracim.model.data import ContentType
@@ -105,10 +106,23 @@ class FakeFileStream(object):
105 106
                 self.update_file()
106 107
             transaction.commit()
107 108
         except SameValueError:
109
+            # INFO - G.M - 21-03-2018 - Do nothing, file as not change.
110
+            msg = 'File {filename} modified through webdav did not change, transaction aborted.'  # nopep8
111
+            logger.debug(
112
+                self,
113
+                msg.format(filename=self._file_name)
114
+            )
108 115
             transaction.abort()
109 116
             transaction.begin()
110
-            raise DAVError(HTTP_NOT_MODIFIED)
111
-        except ValueError:
117
+        except ValueError as e:
118
+            msg = 'File {filename} modified through webdav can\'t be updated: {exception}'  # nopep8
119
+            logger.debug(
120
+                self,
121
+                msg.format(
122
+                    filename=self._file_name,
123
+                    e=e.__str__,
124
+                )
125
+            )
112 126
             transaction.abort()
113 127
             transaction.begin()
114 128
             raise DAVError(HTTP_FORBIDDEN)