Package omeroweb :: Package webredirect :: Module views
[hide private]
[frames] | no frames]

Source Code for Module omeroweb.webredirect.views

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  #  
 4  #  
 5  #  
 6  # Copyright (c) 2008 University of Dundee.  
 7  #  
 8  # This program is free software: you can redistribute it and/or modify 
 9  # it under the terms of the GNU Affero General Public License as 
10  # published by the Free Software Foundation, either version 3 of the 
11  # License, or (at your option) any later version. 
12  #  
13  # This program is distributed in the hope that it will be useful, 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  # GNU Affero General Public License for more details. 
17  #  
18  # You should have received a copy of the GNU Affero General Public License 
19  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
20  #  
21  # Author: Aleksandra Tarkowska <A(dot)Tarkowska(at)dundee(dot)ac(dot)uk>, 2008. 
22  #  
23  # Version: 1.0 
24  # 
25   
26  ''' A view functions is simply a Python function that takes a Web request and  
27  returns a Web response. This response can be the HTML contents of a Web page,  
28  or a redirect, or the 404 and 500 error, or an XML document, or an image...  
29  or anything.''' 
30   
31  from django.http import HttpResponseRedirect, HttpResponseServerError 
32  from django.core.urlresolvers import reverse 
33  from omeroweb.feedback.views import handlerInternalError 
34  import settings 
35  import logging 
36  import traceback 
37   
38  logger = logging.getLogger(__name__) 
39   
40 -def index(request, **kwargs):
41 if request.REQUEST.get('show', None) is not None: 42 url = "?".join([reverse(viewname="webindex"),"show="+request.REQUEST.get('show')]) 43 return HttpResponseRedirect(url) 44 else: 45 return handlerInternalError(request, "Path was not recognized. URL should follow the pattern: %s%s" % (request.build_absolute_uri(reverse(viewname="webredirect")),("?path=server=1|project=1|dataset=2|image=3:selected")))
46