Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Relax restrictions around _start_at and _end_at
Browse files Browse the repository at this point in the history
We represent chunks of time as well as points in time so we should be
able to bound the periods that the data represents.
  • Loading branch information
tombooth committed Dec 15, 2014
1 parent 98e5853 commit 3b0c053
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion backdrop/core/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

RESERVED_KEYWORDS = (
'_timestamp',
'_id'
'_start_at',
'_end_at',
'_id',
)
VALID_KEY = re.compile('^[a-z_][a-z0-9_]+$')

Expand Down Expand Up @@ -107,6 +109,14 @@ def validate_record_data(data):
return invalid(
'_timestamp is not a valid datetime object')

if key == '_start_at' and not isinstance(value, datetime.datetime):
return invalid(
'_start_at is not a valid datetime object')

if key == '_end_at' and not isinstance(value, datetime.datetime):
return invalid(
'_end_at is not a valid datetime object')

if key == '_id' and not value_is_valid_id(value):
return invalid('_id is not a valid id')

Expand Down

0 comments on commit 3b0c053

Please sign in to comment.