Revision 0d0466bf snf-cyclades-app/synnefo/ui/views.py
b/snf-cyclades-app/synnefo/ui/views.py | ||
---|---|---|
45 | 45 |
from django.core.urlresolvers import reverse |
46 | 46 |
from django.core.mail import send_mail |
47 | 47 |
from django.http import Http404 |
48 |
from django.template import RequestContext |
|
48 | 49 |
|
49 | 50 |
from synnefo.util.version import get_component_version |
50 | 51 |
|
... | ... | |
113 | 114 |
FEEDBACK_CONTACTS = getattr(settings, "FEEDBACK_CONTACTS", []) |
114 | 115 |
FEEDBACK_EMAIL_FROM = settings.FEEDBACK_EMAIL_FROM |
115 | 116 |
|
116 |
def template(name, context): |
|
117 |
def template(name, request, context):
|
|
117 | 118 |
template_path = os.path.join(os.path.dirname(__file__), "templates/") |
118 | 119 |
current_template = template_path + name + '.html' |
119 | 120 |
t = loader.get_template(current_template) |
... | ... | |
128 | 129 |
'DEBUG': settings.DEBUG |
129 | 130 |
} |
130 | 131 |
context.update(media_context) |
131 |
return HttpResponse(t.render(Context(context)))
|
|
132 |
return HttpResponse(t.render(RequestContext(request, context)))
|
|
132 | 133 |
|
133 | 134 |
def home(request): |
134 | 135 |
context = {'timeout': TIMEOUT, |
... | ... | |
164 | 165 |
'glance_api_url': json.dumps(GLANCE_API_URL), |
165 | 166 |
'system_images_owners': json.dumps(SYSTEM_IMAGES_OWNERS) |
166 | 167 |
} |
167 |
return template('home', context) |
|
168 |
return template('home', request, context)
|
|
168 | 169 |
|
169 | 170 |
def machines_console(request): |
170 | 171 |
host, port, password = ('','','') |
... | ... | |
176 | 177 |
host_ip_v6 = request.GET.get('host_ip_v6','') |
177 | 178 |
context = {'host': host, 'port': port, 'password': password, |
178 | 179 |
'machine': machine, 'host_ip': host_ip, 'host_ip_v6': host_ip_v6} |
179 |
return template('machines_console', context) |
|
180 |
return template('machines_console', request, context)
|
|
180 | 181 |
|
181 | 182 |
def js_tests(request): |
182 |
return template('tests', {}) |
|
183 |
return template('tests', request, {})
|
|
183 | 184 |
|
184 | 185 |
CONNECT_LINUX_LINUX_MESSAGE = _("""A direct connection to this machine can be established using the <a target="_blank" |
185 | 186 |
href="http://en.wikipedia.org/wiki/Secure_Shell">SSH Protocol</a>. |
Also available in: Unified diff