Package omeroweb :: Package webgateway :: Package templatetags :: Module defaulttags
[hide private]
[frames] | no frames]

Source Code for Module omeroweb.webgateway.templatetags.defaulttags

 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   
27  import traceback 
28  import logging 
29   
30  from urlparse import urljoin 
31  from django import template 
32  from django.templatetags.static import PrefixNode 
33   
34  register = template.Library() 
35   
36  logger = logging.getLogger(__name__) 
37 38 @register.simple_tag 39 -def static(path):
40 """ 41 Joins the given path with the STATIC_URL setting. 42 43 Usage:: 44 45 {% static path %} 46 47 Examples:: 48 49 {% static "myapp/css/base.css" %} 50 {% static variable_with_path %} 51 52 """ 53 return urljoin(PrefixNode.handle_simple("STATIC_URL"), path)
54