Browse Source

Related to #165: Webdav: Don't be critical if member can't be construct

Bastien Sevajol (Algoo) 7 years ago
parent
commit
11add5e96a
1 changed files with 21 additions and 8 deletions
  1. 21 8
      tracim/tracim/lib/webdav/sql_resources.py

+ 21 - 8
tracim/tracim/lib/webdav/sql_resources.py View File

@@ -1,4 +1,6 @@
1 1
 # coding: utf8
2
+import logging
3
+
2 4
 import os
3 5
 
4 6
 import transaction
@@ -27,6 +29,9 @@ from tracim.lib.webdav.utils import normpath
27 29
 
28 30
 from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
29 31
 
32
+logger = logging.getLogger()
33
+
34
+
30 35
 class ManageActions(object):
31 36
     """
32 37
     This object is used to encapsulate all Deletion/Archiving related method as to not duplicate too much code
@@ -474,14 +479,22 @@ class Folder(Workspace):
474 479
         for content in visible_children:
475 480
             content_path = '%s/%s' % (self.path, transform_to_display(content.get_label_as_file()))
476 481
 
477
-            if content.type == ContentType.Folder:
478
-                members.append(Folder(content_path, self.environ, self.workspace, content))
479
-            elif content.type == ContentType.File:
480
-                self._file_count += 1
481
-                members.append(File(content_path, self.environ, content))
482
-            else:
483
-                self._file_count += 1
484
-                members.append(OtherFile(content_path, self.environ, content))
482
+            try:
483
+                if content.type == ContentType.Folder:
484
+                    members.append(Folder(content_path, self.environ, self.workspace, content))
485
+                elif content.type == ContentType.File:
486
+                    self._file_count += 1
487
+                    members.append(File(content_path, self.environ, content))
488
+                else:
489
+                    self._file_count += 1
490
+                    members.append(OtherFile(content_path, self.environ, content))
491
+            except Exception as exc:
492
+                logger.exception(
493
+                    'Unable to construct member {}'.format(
494
+                        content_path,
495
+                    ),
496
+                    exc_info=True,
497
+                )
485 498
 
486 499
         if self._file_count > 0 and self.provider.show_history():
487 500
             members.append(