1
|
# -*- coding: utf-8 -*-
|
2
|
#
|
3
|
# UnivNautes
|
4
|
# Copyright (C) 2014 Entr'ouvert
|
5
|
#
|
6
|
# This program is free software: you can redistribute it and/or modify it under
|
7
|
# the terms of the GNU Affero General Public License as published by the Free
|
8
|
# Software Foundation, either version 3 of the License, or (at your option) any
|
9
|
# later version.
|
10
|
#
|
11
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
12
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
14
|
# details.
|
15
|
#
|
16
|
# You should have received a copy of the GNU Affero General Public License
|
17
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
|
|
19
|
from django.conf import settings
|
20
|
from django.views.generic.base import TemplateView
|
21
|
from django.contrib.auth.decorators import login_required
|
22
|
import urllib2
|
23
|
from django.http import HttpResponse
|
24
|
|
25
|
class Homepage(TemplateView):
|
26
|
'''Homepage View, displays a welcome message'''
|
27
|
template_name = 'homepage.html'
|
28
|
|
29
|
homepage = login_required(Homepage.as_view())
|
30
|
|
31
|
def proxymap(request, z, x, y):
|
32
|
url = settings.PROXYMAP_URL % { 'z': int(z), 'x': int(x), 'y': int(y) }
|
33
|
downstream_request = urllib2.Request(url)
|
34
|
page = urllib2.urlopen(downstream_request)
|
35
|
return HttpResponse(page, page.info().getheader('Content-Type'))
|
36
|
|