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

Fix Revision.from_dict to allow optional fields.

parent e99a5f22
No related branches found
No related tags found
No related merge requests found
......@@ -283,19 +283,16 @@ class Revision(BaseModel):
@classmethod
def from_dict(cls, d):
d = d.copy()
return cls(
id=d['id'],
message=d['message'],
author=Person.from_dict(d['author']),
committer=Person.from_dict(d['committer']),
date=TimestampWithTimezone.from_dict(d['date']),
id=d.pop('id'),
author=Person.from_dict(d.pop('author')),
committer=Person.from_dict(d.pop('committer')),
date=TimestampWithTimezone.from_dict(d.pop('date')),
committer_date=TimestampWithTimezone.from_dict(
d['committer_date']),
type=RevisionType(d['type']),
directory=d['directory'],
synthetic=d['synthetic'],
metadata=d['metadata'],
parents=d['parents'])
d.pop('committer_date')),
type=RevisionType(d.pop('type')),
**d)
@attr.s
......
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