diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 334: Make extensions aware of mount points

Message ID 20111205234113.3082.43053.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Zygmunt Krynicki Dec. 5, 2011, 11:41 p.m. UTC
------------------------------------------------------------
revno: 334
committer: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
branch nick: trunk
timestamp: Tue 2011-12-06 00:39:52 +0100
message:
  Make extensions aware of mount points
modified:
  lava_server/extension.py
  lava_server/urls.py


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_server/extension.py'
--- lava_server/extension.py	2011-11-08 23:48:55 +0000
+++ lava_server/extension.py	2011-12-05 23:39:52 +0000
@@ -47,7 +47,7 @@ 
         """
 
     @abstractmethod
-    def contribute_to_urlpatterns(self, urlpatterns):
+    def contribute_to_urlpatterns(self, urlpatterns, mount_point):
         """
         Add application specific URLs to root URL patterns of lava-server
         """
@@ -159,10 +159,10 @@ 
     def contribute_to_settings_ex(self, settings_module, settings_object):
         pass
 
-    def contribute_to_urlpatterns(self, urlpatterns):
+    def contribute_to_urlpatterns(self, urlpatterns, mount_point):
         from django.conf.urls.defaults import url, include
         urlpatterns += [
-            url(r'^{slug}/'.format(slug=self.slug),
+            url(r'^{mount_point}{slug}/'.format(mount_point=mount_point, slug=self.slug),
                 include('{app_name}.urls'.format(app_name=self.app_name)))]
 
     def get_main_url(self):
@@ -261,12 +261,12 @@ 
                 extension.contribute_to_settings_ex(
                     settings_module, settings_object)
 
-    def contribute_to_urlpatterns(self, urlpatterns):
+    def contribute_to_urlpatterns(self, urlpatterns, mount_point):
         """
         Contribute to lava-server URL patterns
         """
         for extension in self.extensions:
-            extension.contribute_to_urlpatterns(urlpatterns)
+            extension.contribute_to_urlpatterns(urlpatterns, mount_point)
 
     def _find_extensions(self):
         return sorted(

=== modified file 'lava_server/urls.py'
--- lava_server/urls.py	2011-12-05 23:14:55 +0000
+++ lava_server/urls.py	2011-12-05 23:39:52 +0000
@@ -76,4 +76,4 @@ 
 
 
 # Load URLs for extensions
-loader.contribute_to_urlpatterns(urlpatterns)
+loader.contribute_to_urlpatterns(urlpatterns, settings.MOUNT_POINT)