Add more checking for region api
This commit is contained in:
@@ -32,7 +32,8 @@ def _set_region(name: str, cs: ChangeSet) -> DbChangeSet:
|
|||||||
def set_region(name: str, cs: ChangeSet) -> ChangeSet:
|
def set_region(name: str, cs: ChangeSet) -> ChangeSet:
|
||||||
if 'id' not in cs.operations[0] or 'boundary' not in cs.operations[0]:
|
if 'id' not in cs.operations[0] or 'boundary' not in cs.operations[0]:
|
||||||
return ChangeSet()
|
return ChangeSet()
|
||||||
if len(cs.operations[0]['boundary']) < 3:
|
b = cs.operations[0]['boundary']
|
||||||
|
if len(b) < 4 or b[0] != b[-1]:
|
||||||
return ChangeSet()
|
return ChangeSet()
|
||||||
if get_region(name, cs.operations[0]['id']) == {}:
|
if get_region(name, cs.operations[0]['id']) == {}:
|
||||||
return ChangeSet()
|
return ChangeSet()
|
||||||
@@ -54,7 +55,8 @@ def _add_region(name: str, cs: ChangeSet) -> DbChangeSet:
|
|||||||
def add_region(name: str, cs: ChangeSet) -> ChangeSet:
|
def add_region(name: str, cs: ChangeSet) -> ChangeSet:
|
||||||
if 'id' not in cs.operations[0] or 'boundary' not in cs.operations[0]:
|
if 'id' not in cs.operations[0] or 'boundary' not in cs.operations[0]:
|
||||||
return ChangeSet()
|
return ChangeSet()
|
||||||
if len(cs.operations[0]['boundary']) < 3:
|
b = cs.operations[0]['boundary']
|
||||||
|
if len(b) < 4 or b[0] != b[-1]:
|
||||||
return ChangeSet()
|
return ChangeSet()
|
||||||
if get_region(name, cs.operations[0]['id']) != {}:
|
if get_region(name, cs.operations[0]['id']) != {}:
|
||||||
return ChangeSet()
|
return ChangeSet()
|
||||||
|
|||||||
Reference in New Issue
Block a user