3
@mod.route('/participate/<survey_id>/', defaults = {'work_id':None}, methods = ['GET','POST'])
@mod.route('/pariicipate/<survey_id>/<work_id>', methods = ['GET', 'POST'])
def participate(survey_id, work_id):
   /* do_something .. */

I can access http://localhost:5000/participate/512dc365fe8974149091be1f or http://localhost:5000/participate/512dc365fe8974149091be1f/ and if I fire up a debugger I can see that work_id = None.

If I try http://localhost:5000/participate/512dc365fe8974149091be1f/512dc365fe8974149091be1for http://localhost:5000/participate/512dc365fe8974149091be1f/512dc365fe8974149091be1f/ I get 404.

why is this happening? Is there something I've done wrong with routing rules?

thkang
  • 11,215
  • 14
  • 67
  • 83

1 Answers1

2

Your second route has a typo in it :)

@mod.route('/pariicipate/<survey_id>/<work_id>', methods = ['GET', 'POST'])

should be

@mod.route('/participate/<survey_id>/<work_id>', methods = ['GET', 'POST'])
entropy
  • 3,134
  • 20
  • 20