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

+ 1 - 2
tracim/config.py View File

@@ -14,7 +14,6 @@ class RequestWithCFG(Request):
14 14
         return cfg
15 15
 
16 16
 
17
-
18 17
 class CFG(object):
19 18
     """Object used for easy access to config file parameters."""
20 19
 
@@ -87,7 +86,7 @@ class CFG(object):
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 90
         # Verify this
92 91
         #
93 92
         # self.WEBSITE_HOME_TITLE_COLOR = settings.get(

+ 5 - 1
tracim/exceptions.py View File

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

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

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

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

@@ -45,7 +45,8 @@ class Test(Fixture):
45 45
     require = [Base, ]
46 46
 
47 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 51
         lawrence = models.User()
51 52
         lawrence.display_name = 'Lawrence L.'

+ 22 - 6
tracim/logger.py View File

@@ -1,27 +1,43 @@
1 1
 import logging
2 2
 
3
+
3 4
 class Logger(object):
4 5
     TPL = '[{cls}] {msg}'
6
+
5 7
     def __init__(self, logger_name):
6 8
         self._name = logger_name
7 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 13
         if instance_or_class.__class__.__name__ in ('function', 'type'):
11 14
             return instance_or_class.__name__
12 15
         else:
13 16
             return instance_or_class.__class__.__name__
14 17
 
15 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 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 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 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,4 +1,4 @@
1 1
 def includeme(config):
2 2
     config.add_static_view('static', 'static', cache_max_age=3600)
3 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,7 +19,7 @@ class BaseTest(unittest.TestCase):
19 19
         logger.debug(self, 'Setup Test...')
20 20
         self.config = testing.setUp(settings={
21 21
             'sqlalchemy.url': 'sqlite:///:memory:',
22
-            'user.auth_token.validity':'604800',
22
+            'user.auth_token.validity': '604800',
23 23
             'depot_storage_dir': '/tmp/test/depot',
24 24
             'depot_storage_name': 'test',
25 25
             'preview_cache_dir': '/tmp/test/preview_cache',
@@ -28,8 +28,7 @@ class BaseTest(unittest.TestCase):
28 28
         self.config.include('tracim.models')
29 29
         DepotManager._clear()
30 30
         DepotManager.configure(
31
-            'test',
32
-             { 'depot.backend' : 'depot.io.memory.MemoryFileStorage' },
31
+            'test', {'depot.backend': 'depot.io.memory.MemoryFileStorage'}
33 32
         )
34 33
         settings = self.config.get_settings()
35 34
 

+ 2 - 1
tracim/translation.py View File

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