From 36d5746acd9fe6680c46a0779d0f0bbe114d0df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= Date: Thu, 8 Jan 2015 12:10:23 -0600 Subject: [PATCH] layerindex: Add support for rrs in settings.py and urls.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit settings.py: Add APPLICATION variable to switch between layerindex rrs also add context_processors decision layerindex or rrs. urls.py: Add decision for load urls for layerindex or rrs. layerindex/context_processors.py: Add application variable for use templates. Signed-off-by: Aníbal Limón --- layerindex/context_processors.py | 6 ++++-- settings.py | 27 +++++++++++++++++++++++---- urls.py | 14 ++++++++++++-- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/layerindex/context_processors.py b/layerindex/context_processors.py index e2852ee..117697f 100644 --- a/layerindex/context_processors.py +++ b/layerindex/context_processors.py @@ -4,6 +4,7 @@ # # Licensed under the MIT license, see COPYING.MIT for details +import settings from layerindex.models import Branch, LayerItem from django.contrib.sites.models import Site @@ -17,5 +18,6 @@ def layerindex_context(request): 'all_branches': Branch.objects.exclude(name='oe-classic').order_by('sort_priority'), 'unpublished_count': LayerItem.objects.filter(status='N').count(), 'oe_classic': Branch.objects.filter(name='oe-classic'), - 'site_name': site_name - } \ No newline at end of file + 'site_name': site_name, + 'application' : settings.APPLICATION + } diff --git a/settings.py b/settings.py index b21a5b4..4a8ec38 100644 --- a/settings.py +++ b/settings.py @@ -6,6 +6,8 @@ DEBUG = False TEMPLATE_DEBUG = DEBUG +APPLICATION = 'layerindex' # rrs or layerindex + ADMINS = ( # ('Your Name', 'your_email@example.com'), ) @@ -120,10 +122,18 @@ CORS_URLS_REGEX = r'.*/api/.*'; X_FRAME_OPTIONS = 'DENY' from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP -TEMPLATE_CONTEXT_PROCESSORS = TCP + ( - 'django.core.context_processors.request', - 'layerindex.context_processors.layerindex_context', -) +if APPLICATION == 'layerindex': + TEMPLATE_CONTEXT_PROCESSORS = TCP + ( + 'django.core.context_processors.request', + 'layerindex.context_processors.layerindex_context', + ) +elif APPLICATION == 'rrs': + TEMPLATE_CONTEXT_PROCESSORS = TCP + ( + 'django.core.context_processors.request', + 'rrs.context_processors.rrs_context', + ) +else: + raise ValueError('Unknown APPLICATION should be layerindex or rrs') ROOT_URLCONF = 'urls' @@ -146,6 +156,8 @@ INSTALLED_APPS = ( # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'layerindex', + # Uncomment when APPLICATION is RRS + #'rrs', 'registration', 'reversion', 'reversion_compare', @@ -215,3 +227,10 @@ CORE_LAYER_NAME = "openembedded-core" # Settings for layer submission feature SUBMIT_EMAIL_FROM = 'noreply@example.com' SUBMIT_EMAIL_SUBJECT = 'OE Layerindex layer submission' + +# Settings for Recipe reporting system +POKY_REPO_URL = "git://git.yoctoproject.org/poky" + +RRS_EMAIL_SUBJECT = '[Recipe reporting system] Upgradable recipe name list' +RRS_EMAIL_FROM = 'recipe-report@yoctoproject.org' +RRS_EMAIL_TO = 'list@example.com' diff --git a/urls.py b/urls.py index aa4f8c5..6cb2717 100644 --- a/urls.py +++ b/urls.py @@ -5,6 +5,8 @@ # Copyright (c) Django Software Foundation and individual contributors. # All rights reserved. +import settings + from django.conf.urls.defaults import patterns, include, url from django.views.generic.simple import redirect_to @@ -12,10 +14,18 @@ from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', - url(r'^layerindex/', include('layerindex.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('registration.backends.default.urls')), url(r'^captcha/', include('captcha.urls')), - url(r'.*', redirect_to, {'url' : '/layerindex/'}) ) +if settings.APPLICATION == 'layerindex': + urlpatterns += patterns('', + url(r'^layerindex/', include('layerindex.urls')), + url(r'.*', redirect_to, {'url' : '/layerindex/'}), + ) +elif settings.APPLICATION == 'rrs': + urlpatterns += patterns('', + url(r'^rrs/', include('rrs.urls')), + url(r'.*', redirect_to, {'url' : '/rrs/'}), + )