=== modified file 'lava_projects/admin.py'
@@ -18,15 +18,20 @@
from django.contrib import admin
-from lava_projects.models import Project, ProjectFormerIdentifier
+from lava_projects.models import Project, ProjectFormerIdentifier
class ProjectAdmin(admin.ModelAdmin):
- list_display=('__unicode__', 'identifier', 'registered_by', 'registered_on', 'is_public', 'owner')
+
+ list_display = (
+ '__unicode__', 'identifier', 'registered_by',
+ 'registered_on', 'is_public', 'owner')
class ProjectFormerIdentifierAdmin(admin.ModelAdmin):
- list_display=('former_identifier', 'project', 'renamed_on', 'renamed_by')
+
+ list_display = (
+ 'former_identifier', 'project', 'renamed_on', 'renamed_by')
admin.site.register(Project, ProjectAdmin)
=== modified file 'lava_projects/extension.py'
@@ -44,4 +44,5 @@
def version(self):
import lava_projects
import versiontools
- return versiontools.format_version(lava_projects.__version__, hint=lava_projects)
+ return versiontools.format_version(
+ lava_projects.__version__, hint=lava_projects)
=== modified file 'lava_projects/forms.py'
@@ -59,8 +59,8 @@
is_aggregate = forms.BooleanField(
label=_(u"Project is an aggregation (distribution)"),
help_text=_(u"If selected the project will be treated like a"
- u" distribution. Some UI elements are optimized for that case"
- u" and behave differently."),
+ u" distribution. Some UI elements are optimized for that"
+ u" case and behave differently."),
required=False)
def restrict_group_selection_for_user(self, user):
@@ -93,7 +93,7 @@
def clean_identifier(self):
"""
Check that the identifier is correct:
-
+
1) It does not collide with other projects
2) Or their past identifiers
"""
@@ -103,10 +103,14 @@
project = Project.objects.all().get_by_identifier(value)
if project.identifier == value:
# Disallow current identifiers from other projects
- raise ValidationError("Project %s is already using this identifier" % project)
- else:
+ raise ValidationError(
+ "Project {0} is already using this identifier".format(
+ project))
+ else:
# Disallow past identifiers from other projects
- raise ValidationError("Project %s was using this identifier in the past" % project)
+ raise ValidationError(
+ "Project {0} was using this identifier in the past".format(
+ project))
except Project.DoesNotExist:
pass
return value
@@ -125,7 +129,8 @@
name = forms.CharField(
label=_(u"Projet name"),
- help_text=_(u"The new project name, same limits as before (100 chars)"),
+ help_text=_(u"The new project name, same limits as before "
+ u"(100 chars)"),
required=True,
max_length=100)
@@ -143,7 +148,7 @@
def clean_identifier(self):
"""
Check that new identifier is correct:
-
+
1) It does not collide with other projects
2) Or their past identifiers
3) It is different than the one we are currently using
@@ -162,12 +167,13 @@
elif project.identifier == value:
# Disallow current identifiers from other projects
raise ValidationError(
- _(u"Project %s is already using this identifier") % project)
- else:
+ _(u"Project {0} is already using this identifier").format(
+ project))
+ else:
# Disallow past identifiers from other projects
raise ValidationError(
- _(u"Project %s was using this identifier in the past") %
- project)
+ _(u"Project {0} was using this identifier in the"
+ u"past").format(project))
except Project.DoesNotExist:
pass
return value
=== modified file 'lava_projects/models.py'
@@ -42,8 +42,9 @@
return self.get(identifier=identifier)
except Project.DoesNotExist as no_such_project:
try:
- project_former_identifier = ProjectFormerIdentifier.objects.get(former_identifier=identifier)
- return project_former_identifier.project
+ p_f_ir = ProjectFormerIdentifier.objects.get(
+ former_identifier=identifier)
+ return p_f_i.project
except ProjectFormerIdentifier.DoesNotExist:
raise no_such_project
@@ -132,17 +133,17 @@
description = models.TextField(
null=False,
blank=True,
- verbose_name = _(u"Description"),
- help_text = _(u"Arbitrary text about the project, you can use markdown"
- u" formatting to style it"))
+ verbose_name=_(u"Description"),
+ help_text=_(u"Arbitrary text about the project, you can use markdown"
+ u" formatting to style it"))
is_aggregate = models.BooleanField(
blank=True,
null=False,
verbose_name=_(u"Aggregate"),
help_text=_(u"When selected the project will be treated like a"
- u" distribution. Some UI elements are optimized for that case"
- u" and behave differently."))
+ u" distribution. Some UI elements are optimized for that"
+ u" case and behave differently."))
registered_by = models.ForeignKey(
User,
=== modified file 'lava_projects/urls.py'
@@ -21,10 +21,15 @@
urlpatterns = patterns(
'lava_projects.views',
- url('^$', 'project_root', name='lava.project.root'),
- url(r'^\+list/$', 'project_list', name='lava.project.list'),
- url(r'^\+register/$', 'project_register', name='lava.project.register'),
- url(r'^(?P<identifier>[a-z0-9-]+)/$', 'project_detail', name='lava.project.detail'),
- url(r'^(?P<identifier>[a-z0-9-]+)/\+update/$', 'project_update', name='lava.project.update'),
- url(r'^(?P<identifier>[a-z0-9-]+)/\+rename/$', 'project_rename', name='lava.project.rename'),
-)
+ url('^$', 'project_root',
+ name='lava.project.root'),
+ url(r'^\+list/$', 'project_list',
+ name='lava.project.list'),
+ url(r'^\+register/$', 'project_register',
+ name='lava.project.register'),
+ url(r'^(?P<identifier>[a-z0-9-]+)/$', 'project_detail',
+ name='lava.project.detail'),
+ url(r'^(?P<identifier>[a-z0-9-]+)/\+update/$', 'project_update',
+ name='lava.project.update'),
+ url(r'^(?P<identifier>[a-z0-9-]+)/\+rename/$', 'project_rename',
+ name='lava.project.rename'))
=== modified file 'lava_projects/views.py'
@@ -17,7 +17,8 @@
# along with LAVA Server. If not, see <http://www.gnu.org/licenses/>.
from django.contrib.auth.decorators import login_required
-from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden
+from django.http import (
+ HttpResponse, HttpResponseRedirect, HttpResponseForbidden)
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext, loader
from django.utils.translation import ugettext as _
@@ -43,9 +44,9 @@
template_name = "lava_projects/project_root.html"
t = loader.get_template(template_name)
c = RequestContext(request, {
- 'recent_project_list': Project.objects.accessible_by_principal(request.user).recently_registered(),
- 'bread_crumb_trail': BreadCrumbTrail.leading_to(project_root)
- })
+ 'recent_project_list': Project.objects.accessible_by_principal(
+ request.user).recently_registered(),
+ 'bread_crumb_trail': BreadCrumbTrail.leading_to(project_root)})
return HttpResponse(t.render(c))
@@ -56,23 +57,26 @@
queryset=Project.objects.accessible_by_principal(request.user),
template_name="lava_projects/project_list.html",
extra_context={
- 'bread_crumb_trail': BreadCrumbTrail.leading_to(project_list)
- },
+ 'bread_crumb_trail': BreadCrumbTrail.leading_to(
+ project_list)},
template_object_name="project")
-@BreadCrumb("{project}",
+@BreadCrumb("{project}",
parent=project_root,
needs=['project_identifier'])
def project_detail(request, identifier):
# A get by identifier, looking at renames, if needed.
try:
- project = Project.objects.accessible_by_principal(request.user).get_by_identifier(identifier)
+ project = Project.objects.accessible_by_principal(
+ request.user).get_by_identifier(identifier)
except Project.DoesNotExist:
raise Http404("No such project")
- # Redirect users to proper URL of this project if using one of the older names.
+ # Redirect users to proper URL of this project if using one of the older
+ # names.
if project.identifier != identifier:
- return HttpResponseRedirect(project.get_absolute_url() + "?former_identifier=" + identifier)
+ return HttpResponseRedirect(
+ project.get_absolute_url() + "?former_identifier=" + identifier)
# Lookup former identifier if we have been redirected
former_identifier = None
if request.GET.get("former_identifier"):
@@ -86,13 +90,12 @@
t = loader.get_template(template_name)
c = RequestContext(request, {
'project': project,
- 'former_identifier': former_identifier,
+ 'former_identifier': former_identifier,
'belongs_to_user': project.is_owned_by(request.user),
'bread_crumb_trail': BreadCrumbTrail.leading_to(
project_detail,
project=project,
- project_identifier=project.identifier)
- })
+ project_identifier=project.identifier)})
return HttpResponse(t.render(c))
@@ -133,7 +136,7 @@
@login_required
def project_update(request, identifier):
project = get_object_or_404(
- Project.objects.accessible_by_principal(request.user),
+ Project.objects.accessible_by_principal(request.user),
identifier=identifier)
if not project.is_owned_by(request.user):
return HttpResponseForbidden("You cannot update this project")
@@ -163,8 +166,7 @@
'bread_crumb_trail': BreadCrumbTrail.leading_to(
project_update,
project=project,
- project_identifier=project.identifier)
- })
+ project_identifier=project.identifier)})
return HttpResponse(t.render(c))
@@ -174,14 +176,14 @@
@login_required
def project_rename(request, identifier):
project = get_object_or_404(
- Project.objects.accessible_by_principal(request.user),
+ Project.objects.accessible_by_principal(request.user),
identifier=identifier)
if not project.is_owned_by(request.user):
return HttpResponseForbidden("You cannot update this project")
if request.method == 'POST':
form = ProjectRenameForm(project, request.POST)
if form.is_valid():
- # Remove old entry if we are reusing our older identifier
+ # Remove old entry if we are reusing our older identifier
pfi = ProjectFormerIdentifier.objects.filter(
former_identifier=form.cleaned_data['identifier'],
project=project.pk).delete()
@@ -208,6 +210,5 @@
'bread_crumb_trail': BreadCrumbTrail.leading_to(
project_rename,
project=project,
- project_identifier=project.identifier)
- })
+ project_identifier=project.identifier)})
return HttpResponse(t.render(c))
=== modified file 'lava_server/bread_crumbs.py'
@@ -96,7 +96,8 @@
try:
return self.name.format(**kwargs)
except:
- logging.exception("Unable to construct breadcrumb name for view %r", self.view)
+ logging.exception(
+ "Unable to construct breadcrumb name for view %r", self.view)
raise
def get_absolute_url(self, kwargs):
@@ -109,9 +110,12 @@
the kwargs dictionary.
"""
try:
- return reverse(self.view, args=[kwargs[name] for name in self.needs])
+ return reverse(
+ self.view,
+ args=[kwargs[name] for name in self.needs])
except:
- logging.exception("Unable to construct breadcrumb URL for view %r", self.view)
+ logging.exception(
+ "Unable to construct breadcrumb URL for view %r", self.view)
raise
@@ -156,7 +160,8 @@
@classmethod
def leading_to(cls, view, **kwargs):
"""
- Create an instance of BreadCrumbTrail that starts at the specified view.
+ Create an instance of BreadCrumbTrail that starts at the specified
+ view.
Additional keyword arguments, if provided, will be available to
get_name() and get_absolute_url() of each LiveBreadCrumb that makes up
=== modified file 'lava_server/context_processors.py'
@@ -21,10 +21,10 @@
import lava_server
from lava_server.extension import loader
+
def lava(request):
return {
'lava': {
'extension_list': loader.extensions,
- 'version': versiontools.format_version(lava_server.__version__, hint=lava_server)
- }
- }
+ 'version': versiontools.format_version(
+ lava_server.__version__, hint=lava_server)}}
=== modified file 'lava_server/extension.py'
@@ -81,6 +81,12 @@
"""
@abstractmethod
+ def get_front_page_context(self):
+ """
+ Context available to the front page template
+ """
+
+ @abstractmethod
def get_main_url(self):
"""
Absolute URL of the main view
@@ -113,6 +119,9 @@
def front_page_template(self):
return None
+ def get_front_page_context(self):
+ return {}
+
@property
def api_class(self):
"""
@@ -130,7 +139,7 @@
pass
def contribute_to_urlpatterns(self, urlpatterns):
- from django.conf.urls.defaults import url, include
+ from django.conf.urls.defaults import url, include
urlpatterns += [
url(r'^{slug}/'.format(slug=self.slug),
include('{app_name}.urls'.format(app_name=self.app_name)))]
@@ -140,7 +149,6 @@
return reverse(self.main_view_name)
-
class ExtensionLoadError(Exception):
"""
Exception internally raised by extension loader
@@ -161,7 +169,8 @@
"""
def __init__(self):
- self._extensions = None # Load this lazily so that others can import this module
+ # Load this lazily so that others can import this module
+ self._extensions = None
self._mapper = None
@property
@@ -211,7 +220,8 @@
try:
extension = self._load_extension(name)
except ExtensionLoadError as ex:
- logging.exception("Unable to load extension %r: %s", name, ex.message)
+ logging.exception(
+ "Unable to load extension %r: %s", name, ex.message)
else:
self._extensions.append(extension)
return self._extensions
@@ -227,7 +237,8 @@
for extension in self.extensions:
extension.contribute_to_settings(settings_module)
if settings_object is not None:
- extension.contribute_to_settings_ex(settings_module, settings_object)
+ extension.contribute_to_settings_ex(
+ settings_module, settings_object)
def contribute_to_urlpatterns(self, urlpatterns):
"""
@@ -240,7 +251,7 @@
return sorted(
pkg_resources.iter_entry_points(
'lava_server.extensions'),
- key=lambda ep:ep.name)
+ key=lambda ep: ep.name)
def _load_extension(self, entrypoint):
"""
@@ -254,7 +265,8 @@
try:
extension_cls = entrypoint.load()
except ImportError as ex:
- logging.exception("Unable to load extension entry point: %r", entrypoint)
+ logging.exception(
+ "Unable to load extension entry point: %r", entrypoint)
raise ExtensionLoadError(
entrypoint,
"Unable to load extension entry point")
=== modified file 'lava_server/manage.py'
@@ -65,24 +65,33 @@
@classmethod
def register_arguments(cls, parser):
group = parser.add_argument_group("Server configuration")
- group.add_argument("-d", "--development",
- action="store_false",
- dest="production",
- help="Use development settings")
- group.add_argument("-p", "--production",
- action="store_true",
- default=True,
- help="Use production settings (default)")
- group.add_argument("-i", "--instance",
- action="store",
- default=None,
- help="Use the specified instance (works only with --production)")
- group.add_argument("-I", "--instance-template",
- action="store",
- default="/srv/lava/instances/{instance}/etc/lava-server/{{filename}}.conf",
- help="Template used for constructing instance pathname. The default value is: %(default)s")
- parser.add_argument("command", nargs="...",
- help="Invoke this Django management command")
+ group.add_argument(
+ "-d", "--development",
+ action="store_false",
+ dest="production",
+ help="Use development settings")
+ group.add_argument(
+ "-p", "--production",
+ action="store_true",
+ default=True,
+ help="Use production settings (default)")
+ group.add_argument(
+ "-i", "--instance",
+ action="store",
+ default=None,
+ help="Use the specified instance (works only with --production)")
+ group.add_argument(
+ "-I", "--instance-template",
+ action="store",
+ default=(
+ "/srv/lava/instances/{instance}"
+ "/etc/lava-server/{{filename}}.conf"),
+ help=(
+ "Template used for constructing instance pathname."
+ " The default value is: %(default)s"))
+ parser.add_argument(
+ "command", nargs="...",
+ help="Invoke this Django management command")
def invoke(self):
if self.args.production:
@@ -90,7 +99,8 @@
else:
settings_module = "lava_server.settings.development"
if self.args.instance:
- ddst = self.args.instance_template.format(instance=self.args.instance)
+ ddst = self.args.instance_template.format(
+ instance=self.args.instance)
os.environ["DJANGO_DEBIAN_SETTINGS_TEMPLATE"] = ddst
settings = __import__(settings_module, fromlist=[''])
from django.core.management import execute_manager
@@ -115,9 +125,8 @@
settings_module = "lava_server.settings.development"
settings = __import__(settings_module, fromlist=[''])
from django.core.management import execute_manager
- execute_manager(settings)
+ execute_manager(settings)
if __name__ == "__main__":
legacy_main()
-
=== modified file 'lava_server/settings/common.py'
@@ -119,9 +119,7 @@
from openid import oidutil
oidutil.log = lambda msg, level=0: None
-RESTRUCTUREDTEXT_FILTER_SETTINGS = {
- "initial_header_level": 4
-}
+RESTRUCTUREDTEXT_FILTER_SETTINGS = {"initial_header_level": 4}
# Skip south tests as they seem to break everything else.
# This is fixed in south 0.7.1, if we upgrade past that it's safe to
=== modified file 'lava_server/settings/debian.py'
@@ -9,9 +9,7 @@
debian_settings = Settings("lava-server")
# Load default database from Debian integration
-DATABASES = {
- 'default': debian_settings.default_database
-}
+DATABASES = {'default': debian_settings.default_database}
# Load debug settings from the configuration file
DEBUG = debian_settings.DEBUG
@@ -28,7 +26,7 @@
MEDIA_URL = debian_settings.MEDIA_URL
# Absolute filesystem path to the directory that will hold static, read only
-# files collected from all applications.
+# files collected from all applications.
STATIC_ROOT = debian_settings.STATIC_ROOT
# URL that handles the media served from STATIC_ROOT. Make sure to use a
@@ -62,7 +60,7 @@
# link). This is only used if CommonMiddleware is installed (see Middleware.
# See also IGNORABLE_404_STARTS, IGNORABLE_404_ENDS and Error reporting via
# e-mail.
-SEND_BROKEN_LINK_EMAILS=debian_settings.SEND_BROKEN_LINK_EMAILS
+SEND_BROKEN_LINK_EMAILS = debian_settings.SEND_BROKEN_LINK_EMAILS
# Load extensions
loader.contribute_to_settings(locals(), debian_settings)
=== modified file 'lava_server/settings/development.py'
@@ -29,18 +29,20 @@
# environment.
LOCALENV_DIR = os.getenv("VIRTUAL_ENV")
if not LOCALENV_DIR:
- print "Not using lava-dev-tool? Well okay, but just be careful with your imports and python path"
+ print "Not using lava-dev-tool?"
+ print "Well okay, but just be careful with your imports and python path"
# Top-level directory of the project.
#
# This directory MUST contain two sub-directories:
-# * templates/ - project-wide template files
-# * htdocs/ - project-wide static files (_not_ the root of the static file cache)
+# * templates/ - project-wide template files
+# * htdocs/ - project-wide static files
+# (_not_ the root of the static file cache)
PROJECT_SRC_DIR = os.path.normpath(
os.path.join(
os.path.dirname(
os.path.abspath(__file__)),
- ".."))
+ ".."))
# Top-level directory for nonvolatile files, as used by lava-dev-tool. It is a
# sibling directory to localenv so it's easier to define its location as
@@ -48,7 +50,7 @@
if LOCALENV_DIR:
PRECIOUS_DIR = os.path.join(LOCALENV_DIR, "../precious")
else:
- PRECIOUS_DIR = os.path.join(PROJECT_SRC_DIR, "precious")
+ PRECIOUS_DIR = os.path.join(PROJECT_SRC_DIR, "precious")
# Create precious directory if needed
if not os.path.exists(PRECIOUS_DIR):
@@ -89,7 +91,8 @@
DATA_URL_PREFIX = r""
-# XXX: this is ugly, it would be good to have rails-like configuration file in the future
+# XXX: this is ugly!
+# It would be good to have rails-like configuration file in the future
devel_db = os.getenv("DEVEL_DB", "sqlite")
if devel_db == "pgsql":
DATABASES = {
@@ -99,9 +102,7 @@
'USER': 'devel',
'PASSWORD': 'devel',
'HOST': 'localhost',
- 'PORT': ''
- }
- }
+ 'PORT': ''}}
elif devel_db == "sqlite":
DATABASES = {
'default': {
@@ -110,9 +111,7 @@
'USER': '',
'PASSWORD': '',
'HOST': '',
- 'PORT': '',
- }
- }
+ 'PORT': ''}}
elif devel_db == "nosql":
raise ValueError("not yet ;-)")
else:
@@ -124,7 +123,7 @@
MEDIA_ROOT = os.path.join(PROJECT_STATE_DIR, "media", devel_db)
# Absolute filesystem path to the directory that will hold static, read only
-# files collected from all applications.
+# files collected from all applications.
# Example: "/home/media/static.lawrence.com/"
STATIC_ROOT = os.path.join(PROJECT_STATE_DIR, "static")
@@ -144,7 +143,9 @@
ADMIN_MEDIA_PREFIX = "/" + DATA_URL_PREFIX + "static/admin/"
if not DEBUG:
- raise Exception("You need to configure MEDIA_URL, STATIC_URL and ADMIN_MEDIA_PREFIX to point to a production web server")
+ raise Exception(
+ "You need to configure MEDIA_URL, STATIC_URL and ADMIN_MEDIA_PREFIX to"
+ "point to a production web server")
# Make this unique, and don't share it with anybody.
SECRET_KEY = '00000000000000000000000000000000000000000000000000'
@@ -154,15 +155,15 @@
os.path.join(PROJECT_SRC_DIR, "templates"),
)
-STATICFILES_DIRS = [
- ('lava-server', os.path.join(PROJECT_SRC_DIR, 'htdocs'))
-]
-
+STATICFILES_DIRS = [('lava-server', os.path.join(PROJECT_SRC_DIR, 'htdocs'))]
+
+
+INSTALLED_APPS += ['devserver']
# Login redirects back to home
LOGIN_REDIRECT_URL = '/'
-# Any emails that would normally be sent are redirected to stdout.
+# Any emails that would normally be sent are redirected to stdout.
# This setting is only used for django 1.2 and newer.
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
=== modified file 'lava_server/settings/production.py'
@@ -19,7 +19,7 @@
# Django settings for django_hello project.
from lava_server.settings.common import *
-DEBUG = False
+DEBUG = False
TEMPLATE_DEBUG = DEBUG
# Application URL prefix defines where the application is located at
@@ -65,4 +65,6 @@
LOGIN_URL = '/' + DATA_URL_PREFIX + 'accounts/login/'
if DEBUG:
- raise Exception("You should not run this application with debugging in a production environment")
+ raise Exception(
+ "You should not run this application with debugging in a production"
+ " environment")
=== modified file 'lava_server/templates/index.html'
@@ -4,7 +4,7 @@
{% block content %}
<h2>LAVA Highlights</h2>
-{% for extension in lava.extension_list %}
+{% for extension in extension_list %}
{% if extension.front_page_template %}
<h3>{{ extension.description }}</h3>
{% include extension.front_page_template %}
=== modified file 'lava_server/urls.py'
@@ -17,7 +17,8 @@
# along with LAVA Server. If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings
-from django.conf.urls.defaults import handler404, handler500, include, patterns, url
+from django.conf.urls.defaults import (
+ handler404, handler500, include, patterns, url)
from django.contrib import admin
from django.views.generic.simple import direct_to_template
from staticfiles.urls import staticfiles_urlpatterns
@@ -34,25 +35,36 @@
# Root URL patterns
urlpatterns = patterns(
'',
- url(r'^' + settings.APP_URL_PREFIX + r'$', index, name='lava.home'),
- url(r'^' + settings.APP_URL_PREFIX + r'version/$', version, name='lava.version_details'),
- url(r'^' + settings.APP_URL_PREFIX + r'accounts/', include('django.contrib.auth.urls')),
- url(r'^' + settings.APP_URL_PREFIX + r'admin/', include(admin.site.urls)),
- url(r'^' + settings.APP_URL_PREFIX + r'openid/', include('django_openid_auth.urls')),
- url(r'^' + settings.APP_URL_PREFIX + r'RPC2/', 'linaro_django_xmlrpc.views.handler',
+ url(r'^' + settings.APP_URL_PREFIX + r'$',
+ index,
+ name='lava.home'),
+ url(r'^' + settings.APP_URL_PREFIX + r'version/$',
+ version,
+ name='lava.version_details'),
+ url(r'^' + settings.APP_URL_PREFIX + r'accounts/',
+ include('django.contrib.auth.urls')),
+ url(r'^' + settings.APP_URL_PREFIX + r'admin/',
+ include(admin.site.urls)),
+ url(r'^' + settings.APP_URL_PREFIX + r'openid/',
+ include('django_openid_auth.urls')),
+ url(r'^' + settings.APP_URL_PREFIX + r'RPC2/',
+ 'linaro_django_xmlrpc.views.handler',
name='lava.api_handler',
kwargs={
'mapper': loader.xmlrpc_mapper,
'help_view': 'lava.api_help'}),
- url(r'^' + settings.APP_URL_PREFIX + r'api/help/$', 'linaro_django_xmlrpc.views.help',
+ url(r'^' + settings.APP_URL_PREFIX + r'api/help/$',
+ 'linaro_django_xmlrpc.views.help',
name='lava.api_help',
kwargs={
'mapper': loader.xmlrpc_mapper}),
- url(r'^' + settings.APP_URL_PREFIX + r'api/', include(api_urls.token_urlpatterns)),
+ url(r'^' + settings.APP_URL_PREFIX + r'api/',
+ include(api_urls.token_urlpatterns)),
# XXX: This is not needed but without it linaro-django-xmlrpc tests fail
- url(r'^' + settings.APP_URL_PREFIX + r'api/', include(api_urls.default_mapper_urlpatterns)),
- url(r'^' + settings.APP_URL_PREFIX + r'utils/markitup/', include('lava_markitup.urls')),
-)
+ url(r'^' + settings.APP_URL_PREFIX + r'api/',
+ include(api_urls.default_mapper_urlpatterns)),
+ url(r'^' + settings.APP_URL_PREFIX + r'utils/markitup/',
+ include('lava_markitup.urls')))
# Enable static files serving for development server
=== modified file 'lava_server/views.py'
@@ -16,14 +16,24 @@
# You should have received a copy of the GNU Affero General Public License
# along with LAVA Server. If not, see <http://www.gnu.org/licenses/>.
+from django.http import HttpResponse
+from django.template import loader, RequestContext
from django.views.generic.simple import direct_to_template
+from lava_server.extension import loader as extension_loader
+
def index(request):
- return direct_to_template(
- template='index.html')
+ # Start with a list of extensions
+ data = {'extension_list': extension_loader.extensions}
+ # Append each extension context data
+ for extension in extension_loader.extensions:
+ data.update(extension.get_front_page_context())
+ # Load and render the template
+ context = RequestContext(request, data)
+ template = loader.get_template('index.html')
+ return HttpResponse(template.render(context))
def version(request):
- return direct_to_template(
- template='version_details.html')
+ return direct_to_template(request, 'version_details.html')
=== modified file 'lava_server/xmlrpc.py'
@@ -43,4 +43,3 @@
has.
"""
self.register(LavaSystemAPI, 'system')
-