aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-06-25 14:13:08 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-14 14:10:02 +0100
commit5790b60d00c6a564b80d7ef033d84685dd3ef3d4 (patch)
treef4698ad31c68d01b32edd33c2027524d12626b0b /bitbake
parent1712c715f3505e85ece2e32dcc3333ce6b5c1ee7 (diff)
downloadopenembedded-core-contrib-5790b60d00c6a564b80d7ef033d84685dd3ef3d4.tar.gz
bitbake: toaster: automatically discover urls.py files
Added code to automatically discover and add url dispatchers to the urlpattern list. This allows extension of Toaster through adding applications that will be automatically registered with the URL dispatcher. (Bitbake rev: 4000d8224206f404d174a5bc4aa49af55cb44d27) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastermain/urls.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py
index ede5e4f96f..0e7b5c2d77 100644
--- a/bitbake/lib/toaster/toastermain/urls.py
+++ b/bitbake/lib/toaster/toastermain/urls.py
@@ -27,12 +27,10 @@ from django.views.decorators.cache import never_cache
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
-
urlpatterns = patterns('',
- url(r'^simple/', include('bldviewer.urls')),
url(r'^api/1.0/', include('bldviewer.api')),
- url(r'^gui/', include('toastergui.urls')),
- url(r'^$', never_cache(RedirectView.as_view(url='/gui/'))),
+ url(r'^$', never_cache(RedirectView.as_view(url='/toastergui/'))),
+
# Examples:
# url(r'^toaster/', include('toaster.foo.urls')),
@@ -42,3 +40,13 @@ urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
)
+
+# Automatically discover urls.py in various apps, beside our own
+# and map module directories to the patterns
+
+import os
+currentdir = os.path.dirname(__file__)
+for t in os.walk(os.path.dirname(currentdir)):
+ if "urls.py" in t[2] and t[0] != currentdir:
+ modulename = os.path.basename(t[0])
+ urlpatterns.append( url(r'^' + modulename + '/', include ( modulename + '.urls')))