]> git.cworth.org Git - turbot/blobdiff - turbot/actions.py
Don't shove the local variable hunts_table into the turb object
[turbot] / turbot / actions.py
index 911367e2b63d1ff6a3d3d960c2357148d81b0265..00708b0e66f59c78d48b53836c9354708fbe34ba 100644 (file)
@@ -43,7 +43,7 @@ def new_hunt_submission(turb, payload):
     url = state['url']['url']['value']
 
     # Validate that the hunt_id contains no invalid characters
-    if not re.match(r'[-_a-zA-Z0-9]+$', hunt_id):
+    if not re.match(r'[_a-zA-Z0-9]+$', hunt_id):
         print("Hunt ID field is invalid. Attmpting to return a clean error.")
         return {
             'statusCode': 200,
@@ -54,7 +54,7 @@ def new_hunt_submission(turb, payload):
                 "response_action": "errors",
                 "errors": {
                     "hunt_id": "Hunt ID can only contain letters, "
-                    + "numbers, hyphens and underscores"
+                    + "numbers, and underscores"
                 }
             })
         }
@@ -76,8 +76,8 @@ def new_hunt_submission(turb, payload):
     sheet = turbot.sheets.sheets_create(turb, hunt_id)
 
     # Insert the newly-created hunt into the database
-    turb.hunts_table = turb.db.Table("hunts")
-    turb.hunts_table.put_item(
+    hunts_table = turb.db.Table("hunts")
+    hunts_table.put_item(
         Item={
             'channel_id': channel_id,
             "active": True,
@@ -121,7 +121,3 @@ actions = {
         "new_hunt": new_hunt
     }
 }
-
-submission_handlers = {
-    "new_hunt": new_hunt_submission
-}