Browse Source

fix import + small refactor

Guénaël Muller 6 years ago
parent
commit
e7a3fe077a

+ 3 - 0
backend/tracim_backend/app_models/applications.py View File

2
 import typing
2
 import typing
3
 
3
 
4
 from tracim_backend.app_models.contents import ContentType
4
 from tracim_backend.app_models.contents import ContentType
5
+if typing.TYPE_CHECKING:
6
+    from tracim_backend.config import CFG
7
+    from tracim_backend.app_models.contents import ContentStatus
5
 
8
 
6
 
9
 
7
 class Application(object):
10
 class Application(object):

+ 6 - 5
backend/tracim_backend/app_models/contents.py View File

9
 ####
9
 ####
10
 # Content Status
10
 # Content Status
11
 from tracim_backend.lib.core.application import ApplicationApi
11
 from tracim_backend.lib.core.application import ApplicationApi
12
+if typing.TYPE_CHECKING:
13
+    from tracim_backend.app_models.applications import Application
12
 
14
 
13
 
15
 
14
 class GlobalStatus(Enum):
16
 class GlobalStatus(Enum):
167
 
169
 
168
     @property
170
     @property
169
     def Folder(self):
171
     def Folder(self):
170
-        return self.get_one_by_slug('folder')
172
+        return self.get_one_by_slug(folder_type)
171
 
173
 
172
     @property
174
     @property
173
     def File(self):
175
     def File(self):
174
-        return self.get_one_by_slug('file')
176
+        return self.get_one_by_slug(file_type)
175
 
177
 
176
     @property
178
     @property
177
     def Page(self):
179
     def Page(self):
178
-        return self.get_one_by_slug('html-document')
180
+        return self.get_one_by_slug(html_documents_type)
179
 
181
 
180
     @property
182
     @property
181
     def Thread(self):
183
     def Thread(self):
182
-        return self.get_one_by_slug('thread')
184
+        return self.get_one_by_slug(thread_type)
183
 
185
 
184
     def __init__(self, app_list: typing.List['Application']):
186
     def __init__(self, app_list: typing.List['Application']):
185
         self.app_list = app_list
187
         self.app_list = app_list
190
     def _content_types(self):
192
     def _content_types(self):
191
         app_api = ApplicationApi(self.app_list)
193
         app_api = ApplicationApi(self.app_list)
192
         content_types = app_api.get_content_types()
194
         content_types = app_api.get_content_types()
193
-        # content_types.extend(self._special_contents_types)
194
         return content_types
195
         return content_types
195
 
196
 
196
     def get_one_by_slug(self, slug: str) -> ContentType:
197
     def get_one_by_slug(self, slug: str) -> ContentType:

+ 4 - 1
backend/tracim_backend/lib/utils/utils.py View File

7
 
7
 
8
 from redis import Redis
8
 from redis import Redis
9
 from rq import Queue
9
 from rq import Queue
10
-
10
+import typing
11
+if typing.TYPE_CHECKING:
12
+    from tracim_backend.config import CFG
11
 
13
 
12
 DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
14
 DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
13
 DEFAULT_WEBDAV_CONFIG_FILE = "wsgidav.conf"
15
 DEFAULT_WEBDAV_CONFIG_FILE = "wsgidav.conf"
138
 COLOR_DARKEN_SCALE_FACTOR = 0.85
140
 COLOR_DARKEN_SCALE_FACTOR = 0.85
139
 COLOR_LIGHTEN_SCALE_FACTOR = 1.15
141
 COLOR_LIGHTEN_SCALE_FACTOR = 1.15
140
 
142
 
143
+
141
 class Color(object):
144
 class Color(object):
142
     def __init__(self, base_hex_code: str):
145
     def __init__(self, base_hex_code: str):
143
         """
146
         """