Quellcode durchsuchen

one datetime format

Guénaël Muller vor 6 Jahren
Ursprung
Commit
e1a4cbe30b
2 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
  1. 1 0
      tracim/lib/utils/utils.py
  2. 6 5
      tracim/views/core_api/schemas.py

+ 1 - 0
tracim/lib/utils/utils.py Datei anzeigen

5
 
5
 
6
 from tracim.config import CFG
6
 from tracim.config import CFG
7
 
7
 
8
+DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
8
 DEFAULT_WEBDAV_CONFIG_FILE = "wsgidav.conf"
9
 DEFAULT_WEBDAV_CONFIG_FILE = "wsgidav.conf"
9
 DEFAULT_TRACIM_CONFIG_FILE = "development.ini"
10
 DEFAULT_TRACIM_CONFIG_FILE = "development.ini"
10
 
11
 

+ 6 - 5
tracim/views/core_api/schemas.py Datei anzeigen

3
 from marshmallow import post_load
3
 from marshmallow import post_load
4
 from marshmallow.validate import OneOf
4
 from marshmallow.validate import OneOf
5
 
5
 
6
+from tracim.lib.utils.utils import DATETIME_FORMAT
6
 from tracim.models.auth import Profile
7
 from tracim.models.auth import Profile
7
 from tracim.models.contents import CONTENT_DEFAULT_TYPE
8
 from tracim.models.contents import CONTENT_DEFAULT_TYPE
8
 from tracim.models.contents import CONTENT_DEFAULT_STATUS
9
 from tracim.models.contents import CONTENT_DEFAULT_STATUS
47
         example='suri.cate@algoo.fr'
48
         example='suri.cate@algoo.fr'
48
     )
49
     )
49
     created = marshmallow.fields.DateTime(
50
     created = marshmallow.fields.DateTime(
50
-        format='%Y-%m-%dT%H:%M:%SZ',
51
+        format=DATETIME_FORMAT,
51
         description='User account creation date',
52
         description='User account creation date',
52
     )
53
     )
53
     is_active = marshmallow.fields.Bool(
54
     is_active = marshmallow.fields.Bool(
391
 class ContentSchema(ContentDigestSchema):
392
 class ContentSchema(ContentDigestSchema):
392
     current_revision_id = marshmallow.fields.Int(example=12)
393
     current_revision_id = marshmallow.fields.Int(example=12)
393
     created = marshmallow.fields.DateTime(
394
     created = marshmallow.fields.DateTime(
394
-        format='%Y-%m-%dT%H:%M:%SZ',
395
+        format=DATETIME_FORMAT,
395
         description='Content creation date',
396
         description='Content creation date',
396
     )
397
     )
397
     author = marshmallow.fields.Nested(UserDigestSchema)
398
     author = marshmallow.fields.Nested(UserDigestSchema)
398
     modified = marshmallow.fields.DateTime(
399
     modified = marshmallow.fields.DateTime(
399
-        format='%Y-%m-%dT%H:%M:%SZ',
400
+        format=DATETIME_FORMAT,
400
         description='date of last modification of content',
401
         description='date of last modification of content',
401
     )
402
     )
402
     last_modifier = marshmallow.fields.Nested(UserDigestSchema)
403
     last_modifier = marshmallow.fields.Nested(UserDigestSchema)
426
     comment_ids = marshmallow.fields.List(marshmallow.fields.Int(example=4))
427
     comment_ids = marshmallow.fields.List(marshmallow.fields.Int(example=4))
427
     revision_id = marshmallow.fields.Int(example=12)
428
     revision_id = marshmallow.fields.Int(example=12)
428
     created = marshmallow.fields.DateTime(
429
     created = marshmallow.fields.DateTime(
429
-        format='%Y-%m-%dT%H:%M:%SZ',
430
+        format=DATETIME_FORMAT,
430
         description='Content creation date',
431
         description='Content creation date',
431
     )
432
     )
432
     author = marshmallow.fields.Nested(UserDigestSchema)
433
     author = marshmallow.fields.Nested(UserDigestSchema)
458
     )
459
     )
459
     author = marshmallow.fields.Nested(UserDigestSchema)
460
     author = marshmallow.fields.Nested(UserDigestSchema)
460
     created = marshmallow.fields.DateTime(
461
     created = marshmallow.fields.DateTime(
461
-        format='%Y-%m-%dT%H:%M:%SZ',
462
+        format=DATETIME_FORMAT,
462
         description='comment creation date',
463
         description='comment creation date',
463
     )
464
     )
464
 
465