mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-21 06:47:42 +00:00
Partial fix for mypy issues
This commit is contained in:
@@ -106,13 +106,14 @@ class V1APISpotHandler(tornado.web.RequestHandler):
|
||||
return
|
||||
|
||||
# Reject if activity ref format incorrect for activity
|
||||
ref_regex = get_ref_regex_for_activity(spot.sig) if spot.sig else None
|
||||
if (
|
||||
spot.sig
|
||||
and spot.sig_refs
|
||||
and len(spot.sig_refs) > 0
|
||||
and spot.sig_refs[0].id
|
||||
and get_ref_regex_for_activity(spot.sig)
|
||||
and not re.match(get_ref_regex_for_activity(spot.sig), spot.sig_refs[0].id)
|
||||
and ref_regex
|
||||
and not re.match(ref_regex, spot.sig_refs[0].id)
|
||||
):
|
||||
self.set_status(422)
|
||||
self.write(
|
||||
@@ -127,6 +128,8 @@ class V1APISpotHandler(tornado.web.RequestHandler):
|
||||
# infer missing data, and add it to our database.
|
||||
spot.source = "API"
|
||||
spot.infer_missing()
|
||||
assert self._spots is not None, "initialize() must be called before post()"
|
||||
assert spot.id is not None, "infer_missing() always assigns an id"
|
||||
self._spots.set(spot.id, spot)
|
||||
|
||||
self.write(safe_json_dumps("OK"))
|
||||
|
||||
Reference in New Issue
Block a user