Skip to content
Snippets Groups Projects
Commit 95829857 authored by vlorentz's avatar vlorentz
Browse files

Add optional 'ctime' field to Content.

parent 767ed202
No related branches found
No related tags found
No related merge requests found
......@@ -335,6 +335,9 @@ class Content(BaseModel):
default=None,
validator=attr.validators.optional([]))
ctime = attr.ib(type=Optional[datetime.datetime],
default=None)
@length.validator
def check_length(self, attribute, value):
"""Checks the length is positive."""
......@@ -353,8 +356,7 @@ class Content(BaseModel):
def to_dict(self):
content = attr.asdict(self)
if content['data'] is None:
del content['data']
if content['reason'] is None:
del content['reason']
for field in ('data', 'reason', 'ctime'):
if content[field] is None:
del content[field]
return content
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment