Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit 1aa6bc7

Browse files
committed
fix selector path not striping out leading /
1 parent 1a77114 commit 1aa6bc7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

script.module.codequick/lib/codequick/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from __future__ import absolute_import
3434

3535
# Package imports
36-
from codequick.support import run
36+
from codequick.support import run, get_route
3737
from codequick.resolver import Resolver
3838
from codequick.listing import Listitem
3939
from codequick.script import Script

script.module.codequick/lib/codequick/support.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,12 @@ def parse_args(self, redirect=None):
245245
if not (key.startswith(u"_") and key.endswith(u"_"))}
246246

247247
def get_route(self, path=None): # type: (str) -> Route
248-
"""Return the given route object."""
249-
path = path.rstrip("/") if path else self.selector
248+
"""
249+
Return the given route callback.
250+
251+
:param str path: The route path, if not given defaults to current callback
252+
"""
253+
path = path.rstrip("/") if path else self.selector.rstrip("/")
250254

251255
# Attempt to import the module where the route
252256
# is located if it's not already registered
@@ -312,7 +316,7 @@ def run_callback(self, process_errors=True, redirect=None):
312316

313317
try:
314318
# Fetch the controling class and callback function/method
315-
route = self.get_route()
319+
route = self.get_route(self.selector)
316320
execute_time = time.time()
317321
redirect = None
318322

@@ -428,3 +432,4 @@ def build_path(callback=None, args=None, query=None, **extra_query):
428432
# Dispatcher to manage route callbacks
429433
dispatcher = Dispatcher()
430434
run = dispatcher.run_callback
435+
get_route = dispatcher.get_route

0 commit comments

Comments
 (0)