Browse Source

Merge branch 'beta_1.0' of https://github.com/tracim/tracim into beta_1.0

tracim 8 years ago
parent
commit
cf470dfc1e

+ 3 - 0
tracim/development.ini.base View File

202
 ## in this case, you have to create your own proxy behind this url.
202
 ## in this case, you have to create your own proxy behind this url.
203
 # radicale.client.base_url = http://127.0.0.1:5232
203
 # radicale.client.base_url = http://127.0.0.1:5232
204
 
204
 
205
+## WSGIDAV
206
+wsgidav.config_path = wsgidav.conf
207
+
205
 #####
208
 #####
206
 #
209
 #
207
 # All configuration below is about logging.
210
 # All configuration below is about logging.

+ 2 - 0
tracim/tracim/config/app_cfg.py View File

296
             '604800',
296
             '604800',
297
         ))
297
         ))
298
 
298
 
299
+        self.WSGIDAV_CONFIG_PATH = tg.config.get('wsgidav.config_path')
300
+
299
     def get_tracker_js_content(self, js_tracker_file_path = None):
301
     def get_tracker_js_content(self, js_tracker_file_path = None):
300
         js_tracker_file_path = tg.config.get('js_tracker_path', None)
302
         js_tracker_file_path = tg.config.get('js_tracker_path', None)
301
         if js_tracker_file_path:
303
         if js_tracker_file_path:

+ 11 - 5
tracim/tracim/controllers/content.py View File

712
 
712
 
713
         fake_api = Context(CTX.FOLDER).toDict(fake_api_content)
713
         fake_api = Context(CTX.FOLDER).toDict(fake_api_content)
714
 
714
 
715
-        fake_api.sub_items = Context(CTX.FOLDER_CONTENT_LIST).toDict(
716
-            folder.get_valid_children([ContentType.Folder,
717
-                                       ContentType.File,
718
-                                       ContentType.Page,
719
-                                       ContentType.Thread]))
715
+        sub_items = content_api.get_children(
716
+            parent_id=folder.content_id,
717
+            content_types=[
718
+                ContentType.Folder,
719
+                ContentType.File,
720
+                ContentType.Page,
721
+                ContentType.Thread,
722
+            ],
723
+
724
+        )
725
+        fake_api.sub_items = Context(CTX.FOLDER_CONTENT_LIST).toDict(sub_items)
720
 
726
 
721
         fake_api.content_types = Context(CTX.DEFAULT).toDict(
727
         fake_api.content_types = Context(CTX.DEFAULT).toDict(
722
             content_api.get_all_types())
728
             content_api.get_all_types())

+ 18 - 0
tracim/tracim/lib/content.py View File

467
 
467
 
468
         return resultset.all()
468
         return resultset.all()
469
 
469
 
470
+    def get_children(self, parent_id: int, content_types: list, workspace: Workspace=None) -> [Content]:
471
+        """
472
+        Return parent_id childs of given content_types
473
+        :param parent_id: parent id
474
+        :param content_types: list of types
475
+        :param workspace: workspace filter
476
+        :return: list of content
477
+        """
478
+        resultset = self._base_query(workspace)
479
+        resultset = resultset.filter(Content.type.in_(content_types))
480
+
481
+        if parent_id:
482
+            resultset = resultset.filter(Content.parent_id==parent_id)
483
+        if parent_id is False:
484
+            resultset = resultset.filter(Content.parent_id == None)
485
+
486
+        return resultset.all()
487
+
470
     # TODO find an other name to filter on is_deleted / is_archived
488
     # TODO find an other name to filter on is_deleted / is_archived
471
     def get_all_with_filter(self, parent_id: int=None, content_type: str=ContentType.Any, workspace: Workspace=None) -> [Content]:
489
     def get_all_with_filter(self, parent_id: int=None, content_type: str=ContentType.Any, workspace: Workspace=None) -> [Content]:
472
         assert parent_id is None or isinstance(parent_id, int) # DYN_REMOVE
490
         assert parent_id is None or isinstance(parent_id, int) # DYN_REMOVE

+ 3 - 1
tracim/tracim/lib/daemons.py View File

268
 
268
 
269
     def _initConfig(self):
269
     def _initConfig(self):
270
         """Setup configuration dictionary from default, command line and configuration file."""
270
         """Setup configuration dictionary from default, command line and configuration file."""
271
+        from tg import config as tg_config
271
 
272
 
272
         # Set config defaults
273
         # Set config defaults
273
         config = DEFAULT_CONFIG.copy()
274
         config = DEFAULT_CONFIG.copy()
274
         temp_verbose = config["verbose"]
275
         temp_verbose = config["verbose"]
275
 
276
 
276
         # Configuration file overrides defaults
277
         # Configuration file overrides defaults
277
-        config_file = os.path.abspath(DEFAULT_CONFIG_FILE)
278
+        default_config_file = os.path.abspath(DEFAULT_CONFIG_FILE)
279
+        config_file = tg_config.get('wsgidav.config_path', default_config_file)
278
         fileConf = self._readConfigFile(config_file, temp_verbose)
280
         fileConf = self._readConfigFile(config_file, temp_verbose)
279
         config.update(fileConf)
281
         config.update(fileConf)
280
 
282