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

Allow -1 as Content length.

It denotes files whose length is unknown.
parent 95829857
No related branches found
No related tags found
No related merge requests found
......@@ -341,8 +341,10 @@ class Content(BaseModel):
@length.validator
def check_length(self, attribute, value):
"""Checks the length is positive."""
if value < 0:
raise ValueError('Length must be positive.')
if self.status == 'absent' and value < -1:
raise ValueError('Length must be positive or -1.')
elif self.status != 'absent' and value < 0:
raise ValueError('Length must be positive, unless status=absent.')
@reason.validator
def check_reason(self, attribute, value):
......
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