xbmcswift2
xbmcswift2 copied to clipboard
function arg could be empty string, the matching rule regex updated.
sometimes, like an optional search keyboard, could be an empty string in the url like /
I'm not sure this is the best soluton. I want xbmcswift's URL routing code to behave like real world URLs so there aren't any surprises. I believe a double slash "//" in the path of the URL is technically invalid. Most web frameworks that I've tested seem to condense multiple slashes into a single one.
When I encounter this situation, I attach multiple routes to a view and have a default arg of None:
@plugin.route('/categories/', name='all_categories')
@plugin.route('/categories/<category>/')
def show_categories(category=None):
pass
What do you think?
well, your workaround works for it, I didn't thought it. but, the plugin:// url used only in xbmc and resolved only by xbmcswift2 itself it's still not a remarkable reason for not support empty argument matching, right? on the other hand, support empty argument will let the code simple, and as an option. developers can choose if he want pretty url slash or he want simple.