Guénaël Muller 7 years ago
parent
commit
dd40482b33

+ 1 - 2
tracim/config.py View File

14
         return cfg
14
         return cfg
15
 
15
 
16
 
16
 
17
-
18
 class CFG(object):
17
 class CFG(object):
19
     """Object used for easy access to config file parameters."""
18
     """Object used for easy access to config file parameters."""
20
 
19
 
87
             '',
86
             '',
88
         )
87
         )
89
 
88
 
90
-        # TODO - G.M - 26-03-2018 - [Cleanup] These params seems deprecated for tracimv2,
89
+        # TODO - G.M - 26-03-2018 - [Cleanup] These params seems deprecated for tracimv2,  # nopep8
91
         # Verify this
90
         # Verify this
92
         #
91
         #
93
         # self.WEBSITE_HOME_TITLE_COLOR = settings.get(
92
         # self.WEBSITE_HOME_TITLE_COLOR = settings.get(

+ 5 - 1
tracim/exceptions.py View File

4
 class TracimError(Exception):
4
 class TracimError(Exception):
5
     pass
5
     pass
6
 
6
 
7
+
7
 class TracimException(Exception):
8
 class TracimException(Exception):
8
     pass
9
     pass
9
 
10
 
11
+
10
 class RunTimeError(TracimError):
12
 class RunTimeError(TracimError):
11
     pass
13
     pass
12
 
14
 
34
 class CommandAbortedError(CommandError):
36
 class CommandAbortedError(CommandError):
35
     pass
37
     pass
36
 
38
 
39
+
37
 class DaemonException(TracimException):
40
 class DaemonException(TracimException):
38
     pass
41
     pass
39
 
42
 
53
 class NotFound(TracimException):
56
 class NotFound(TracimException):
54
     pass
57
     pass
55
 
58
 
59
+
56
 class SameValueError(ValueError):
60
 class SameValueError(ValueError):
57
-    pass
61
+    pass

+ 1 - 0
tracim/fixtures/__init__.py View File

1
 import transaction
1
 import transaction
2
 
2
 
3
+
3
 class Fixture(object):
4
 class Fixture(object):
4
 
5
 
5
     """ Fixture classes (list) required for this fixtures"""
6
     """ Fixture classes (list) required for this fixtures"""

+ 2 - 1
tracim/fixtures/users_and_groups.py View File

45
     require = [Base, ]
45
     require = [Base, ]
46
 
46
 
47
     def insert(self):
47
     def insert(self):
48
-        g2 = self._session.query(models.Group).filter(models.Group.group_name == 'managers').one()
48
+        g2 = self._session.query(models.Group).\
49
+            filter(models.Group.group_name == 'managers').one()
49
 
50
 
50
         lawrence = models.User()
51
         lawrence = models.User()
51
         lawrence.display_name = 'Lawrence L.'
52
         lawrence.display_name = 'Lawrence L.'

+ 22 - 6
tracim/logger.py View File

1
 import logging
1
 import logging
2
 
2
 
3
+
3
 class Logger(object):
4
 class Logger(object):
4
     TPL = '[{cls}] {msg}'
5
     TPL = '[{cls}] {msg}'
6
+
5
     def __init__(self, logger_name):
7
     def __init__(self, logger_name):
6
         self._name = logger_name
8
         self._name = logger_name
7
         self._logger = logging.getLogger(self._name)
9
         self._logger = logging.getLogger(self._name)
8
 
10
 
9
-    def _txt(self, instance_or_class):
11
+    @classmethod
12
+    def _txt(cls, instance_or_class):
10
         if instance_or_class.__class__.__name__ in ('function', 'type'):
13
         if instance_or_class.__class__.__name__ in ('function', 'type'):
11
             return instance_or_class.__name__
14
             return instance_or_class.__name__
12
         else:
15
         else:
13
             return instance_or_class.__class__.__name__
16
             return instance_or_class.__class__.__name__
14
 
17
 
15
     def debug(self, instance_or_class, message):
18
     def debug(self, instance_or_class, message):
16
-        self._logger.debug(Logger.TPL.format(cls=self._txt(instance_or_class), msg=message))
19
+        self._logger.debug(
20
+            Logger.TPL.format(cls=self._txt(instance_or_class), msg=message)
21
+        )
17
 
22
 
18
     def error(self, instance_or_class, message, exc_info=0):
23
     def error(self, instance_or_class, message, exc_info=0):
19
-        self._logger.error(Logger.TPL.format(cls=self._txt(instance_or_class), msg=message, exc_info=exc_info))
24
+        self._logger.error(
25
+            Logger.TPL.format(
26
+                cls=self._txt(instance_or_class),
27
+                msg=message,
28
+                exc_info=exc_info
29
+            )
30
+        )
20
 
31
 
21
     def info(self, instance_or_class, message):
32
     def info(self, instance_or_class, message):
22
-        self._logger.info(Logger.TPL.format(cls=self._txt(instance_or_class), msg=message))
33
+        self._logger.info(
34
+            Logger.TPL.format(cls=self._txt(instance_or_class), msg=message)
35
+        )
23
 
36
 
24
     def warning(self, instance_or_class, message):
37
     def warning(self, instance_or_class, message):
25
-        self._logger.warning(Logger.TPL.format(cls=self._txt(instance_or_class), msg=message))
38
+        self._logger.warning(
39
+            Logger.TPL.format(cls=self._txt(instance_or_class), msg=message)
40
+        )
41
+
26
 
42
 
27
-logger = Logger('tracim')
43
+logger = Logger('tracim')

+ 1 - 1
tracim/routes.py View File

1
 def includeme(config):
1
 def includeme(config):
2
     config.add_static_view('static', 'static', cache_max_age=3600)
2
     config.add_static_view('static', 'static', cache_max_age=3600)
3
     config.add_route('home', '/')
3
     config.add_route('home', '/')
4
-    config.add_route('test_config', '/test_config')
4
+    config.add_route('test_config', '/test_config')

+ 2 - 3
tracim/tests/__init__.py View File

19
         logger.debug(self, 'Setup Test...')
19
         logger.debug(self, 'Setup Test...')
20
         self.config = testing.setUp(settings={
20
         self.config = testing.setUp(settings={
21
             'sqlalchemy.url': 'sqlite:///:memory:',
21
             'sqlalchemy.url': 'sqlite:///:memory:',
22
-            'user.auth_token.validity':'604800',
22
+            'user.auth_token.validity': '604800',
23
             'depot_storage_dir': '/tmp/test/depot',
23
             'depot_storage_dir': '/tmp/test/depot',
24
             'depot_storage_name': 'test',
24
             'depot_storage_name': 'test',
25
             'preview_cache_dir': '/tmp/test/preview_cache',
25
             'preview_cache_dir': '/tmp/test/preview_cache',
28
         self.config.include('tracim.models')
28
         self.config.include('tracim.models')
29
         DepotManager._clear()
29
         DepotManager._clear()
30
         DepotManager.configure(
30
         DepotManager.configure(
31
-            'test',
32
-             { 'depot.backend' : 'depot.io.memory.MemoryFileStorage' },
31
+            'test', {'depot.backend': 'depot.io.memory.MemoryFileStorage'}
33
         )
32
         )
34
         settings = self.config.get_settings()
33
         settings = self.config.get_settings()
35
 
34
 

+ 2 - 1
tracim/translation.py View File

1
 
1
 
2
-# TODO - G.M - 27-03-2018 - [i18n] Reconnect true internationalization
2
+
3
 def fake_translator(text: str):
3
 def fake_translator(text: str):
4
+    # TODO - G.M - 27-03-2018 - [i18n] Reconnect true internationalization
4
     return text
5
     return text