fixed router bug and new test, thanks Jonathan

This commit is contained in:
Massimo DiPierro
2012-06-05 17:15:17 -05:00
parent f09392ce2d
commit 1a61014ec8
3 changed files with 47 additions and 11 deletions
+10 -10
View File
@@ -397,6 +397,16 @@ def load_routers(all_apps):
router.languages = set(router.languages)
else:
router.languages = set()
if router.functions:
if isinstance(router.functions, (set, tuple, list)):
functions = set(router.functions)
if isinstance(router.default_function, str):
functions.add(router.default_function) # legacy compatibility
router.functions = { router.default_controller: functions }
for controller in router.functions:
router.functions[controller] = set(router.functions[controller])
else:
router.functions = dict()
if app != 'BASE':
for base_only in ROUTER_BASE_KEYS:
router.pop(base_only, None)
@@ -412,16 +422,6 @@ def load_routers(all_apps):
if router.controllers:
router.controllers.add('static')
router.controllers.add(router.default_controller)
if router.functions:
if isinstance(router.functions, (set, tuple, list)):
functions = set(router.functions)
if isinstance(router.default_function, str):
functions.add(router.default_function) # legacy compatibility
router.functions = { router.default_controller: functions }
for controller in router.functions:
router.functions[controller] = set(router.functions[controller])
else:
router.functions = dict()
if isinstance(routers.BASE.applications, str) and routers.BASE.applications == 'ALL':
routers.BASE.applications = list(all_apps)