Przeglądaj źródła

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

Bastien Sevajol (Algoo) 8 lat temu
rodzic
commit
11add5e96a
1 zmienionych plików z 21 dodań i 8 usunięć
  1. 21 8
      tracim/tracim/lib/webdav/sql_resources.py

+ 21 - 8
tracim/tracim/lib/webdav/sql_resources.py Wyświetl plik

1
 # coding: utf8
1
 # coding: utf8
2
+import logging
3
+
2
 import os
4
 import os
3
 
5
 
4
 import transaction
6
 import transaction
27
 
29
 
28
 from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
30
 from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
29
 
31
 
32
+logger = logging.getLogger()
33
+
34
+
30
 class ManageActions(object):
35
 class ManageActions(object):
31
     """
36
     """
32
     This object is used to encapsulate all Deletion/Archiving related method as to not duplicate too much code
37
     This object is used to encapsulate all Deletion/Archiving related method as to not duplicate too much code
474
         for content in visible_children:
479
         for content in visible_children:
475
             content_path = '%s/%s' % (self.path, transform_to_display(content.get_label_as_file()))
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
         if self._file_count > 0 and self.provider.show_history():
499
         if self._file_count > 0 and self.provider.show_history():
487
             members.append(
500
             members.append(