From 05580ac6ddd536f2a310f2c8639f5fa6e4708904 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Fri, 13 May 2011 18:23:13 +0400 Subject: [PATCH] Added package_data attributes to django-nova and django-nova-syspanel to install templates with this packages. Fixed url displayed as "Sign In" (made it use url template tag). Little hack to login.html to make it redirect to index page even when Dashboard is accessed not from server's root. Removed ancient hack from django.wsgi. It was needed only for very old Django versions. --- django-nova-syspanel/setup.py | 1 + django-nova/setup.py | 2 ++ .../dashboard/templates/base-root.html | 2 +- .../templates/registration/login.html | 2 +- openstack-dashboard/dashboard/wsgi/django.wsgi | 18 +----------------- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/django-nova-syspanel/setup.py b/django-nova-syspanel/setup.py index bca22b3d0..8c18f9150 100644 --- a/django-nova-syspanel/setup.py +++ b/django-nova-syspanel/setup.py @@ -15,6 +15,7 @@ setup( author_email = 'xtoddx@gmail.com', packages = find_packages('src'), package_dir = {'': 'src'}, + package_data = {'django_nova_syspanel': ['templates/django_nova_syspanel/*.html','templates/django_nova_syspanel/*/*.html',]}, install_requires = ['setuptools', 'boto==1.9b', 'mox>=0.5.0'], classifiers = [ 'Development Status :: 4 - Beta', diff --git a/django-nova/setup.py b/django-nova/setup.py index b82e058c5..28ae54a51 100755 --- a/django-nova/setup.py +++ b/django-nova/setup.py @@ -15,6 +15,8 @@ setup( author_email = 'devin.carlen@gmail.com', packages = find_packages('src'), package_dir = {'': 'src'}, + package_data = {'': ['templates/django_nova/*.html','templates/django_nova/*/*.html', + 'templates/admin/*.html','templates/admin/*/*.html',]}, install_requires = ['setuptools', 'boto==1.9b', 'mox>=0.5.0', 'nova-adminclient'], classifiers = [ diff --git a/openstack-dashboard/dashboard/templates/base-root.html b/openstack-dashboard/dashboard/templates/base-root.html index 7454a3423..358415203 100644 --- a/openstack-dashboard/dashboard/templates/base-root.html +++ b/openstack-dashboard/dashboard/templates/base-root.html @@ -30,7 +30,7 @@ {% else %}
- Sign In + Sign In
{% endif %} diff --git a/openstack-dashboard/dashboard/templates/registration/login.html b/openstack-dashboard/dashboard/templates/registration/login.html index 2e85c7ed5..7155089e6 100644 --- a/openstack-dashboard/dashboard/templates/registration/login.html +++ b/openstack-dashboard/dashboard/templates/registration/login.html @@ -25,7 +25,7 @@ {% if form.errors %}

Your username and password didn't match. Please try again.

{% endif %} - + {{ form.username.label_tag }}{{ form.username }} {{ form.password.label_tag }}{{ form.password }}
diff --git a/openstack-dashboard/dashboard/wsgi/django.wsgi b/openstack-dashboard/dashboard/wsgi/django.wsgi index 9c821ecbe..0a052d249 100644 --- a/openstack-dashboard/dashboard/wsgi/django.wsgi +++ b/openstack-dashboard/dashboard/wsgi/django.wsgi @@ -9,21 +9,5 @@ sys.stdout = sys.stderr DEBUG = False -class WSGIRequest(django.core.handlers.wsgi.WSGIRequest): - def is_secure(self): - value = self.META.get('wsgi.url_scheme', '').lower() - if value == 'https': - return True - return False - -class WSGIHandler(django.core.handlers.wsgi.WSGIHandler): - request_class = WSGIRequest - -_application = WSGIHandler() - -def application(environ, start_response): - environ['PATH_INFO'] = environ['SCRIPT_NAME'] + environ['PATH_INFO'] - environ['wsgi.url_scheme'] = environ.get('HTTP_X_URL_SCHEME', 'http') - - return _application(environ, start_response) +application = django.core.handlers.wsgi.WSGIHandler()