librelist archives

« back to archive

Optional Subdomain

Optional Subdomain

From:
Casey Milford
Date:
2013-12-16 @ 18:07
I'm trying to use Flask-Classy (or Blueprints, I've tried both) to group a
set of methods together (/directory in this case).

Pre Flask 0.10, I was able to register the Flask-Classy class or Blueprint
twice, once with the subdomain='<dir_id>' option, once with no subdomain,
thus allowing the subdomain to be optional.  (If I only register with a
subdomain, then when no subdomain is used, a 404 is given since the route
does not match.)  After upgrading to 0.10.1, I now get this error:
"AssertionError: View function mapping is overwriting an existing endpoint
function: directory:create"

Searching, I found https://github.com/mitsuhiko/flask/issues/794
Essentially, 0.10 fixed a bug where overwriting endpoints was allowed.

How can I use subdomains and make them optional on some of my
classes/blueprints?  Any help would be appreciated!

Thank you,
Casey