Skip to content

function arg could be empty string, the matching rule regex updated.#70

Open
ulion wants to merge 1 commit intojbeluch:masterfrom
ulion:empty_func_arg_matching
Open

function arg could be empty string, the matching rule regex updated.#70
ulion wants to merge 1 commit intojbeluch:masterfrom
ulion:empty_func_arg_matching

Conversation

@ulion
Copy link
Contributor

@ulion ulion commented Dec 31, 2012

sometimes, like an optional search keyboard, could be an empty string in the url like // will result '//', which could not be corrected parsed. this commit will fix it.

@jbeluch
Copy link
Owner

jbeluch commented Jan 1, 2013

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?

@ulion
Copy link
Contributor Author

ulion commented Jan 1, 2013

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.

@ghost ghost assigned jbeluch Feb 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants