def _inject_django_things_into_namespace(request, ns):
ns['_'] = _
ns['request'] = request
+ ns['ROOT'] = request.META['SCRIPT_NAME']
ns['user'] = getattr(request, 'user', None)
ns.update(genshi_namespace.__dict__)
import os
+os.environ['PYTHON_EGG_CACHE'] = '/tmp/eggs'
+
BASE_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
HERE = lambda s: os.path.join(BASE_DIRECTORY, s)
<body>
<h1>${title}</h1>
(Note: some course materials may require you
- to <a href="/syrup/accounts/login/?next=/syrup/">log in</a>)
+ to <a href="${ROOT}/accounts/login/?next=${ROOT}/">log in</a>)
<h2>Choose from one of the options below:</h2>
<ul>
<li><a href="courses">Browse by Course Name</a></li>
<xi:include href="components/course.xhtml"/>
<head>
<title>${title}</title>
- <script type="text/javascript" src="/syrup/static/menublocks.js"/>
+ <script type="text/javascript" src="${ROOT}/static/menublocks.js"/>
</head>
<body>
${course_banner(course)}
<xi:include href="components/course.xhtml"/>
<head>
<title>${title}</title>
- <script type="text/javascript" src="/syrup/static/edit_course.js"/>
+ <script type="text/javascript" src="${ROOT}/static/edit_course.js"/>
</head>
<body>
<div py:if="instance.id">${course_banner(instance)}</div>
<xi:include href="components/course.xhtml"/>
<head>
<title>${title}</title>
- <script type="text/javascript" src="/syrup/static/edit_course_permissions.js"/>
+ <script type="text/javascript" src="${ROOT}/static/edit_course_permissions.js"/>
</head>
<body>
${course_banner(course)}
<xi:include href="../components/course.xhtml"/>
<head>
<title>${title}</title>
- <script type="text/javascript" src="/syrup/static/menublocks.js"/>
+ <script type="text/javascript" src="${ROOT}/static/menublocks.js"/>
</head>
<body>
${course_banner(course)}
<xi:include href="components/course.xhtml"/>
<head>
<title>${title}</title>
- <script type="text/javascript" src="/syrup/static/menublocks.js"/>
+ <script type="text/javascript" src="${ROOT}/static/menublocks.js"/>
</head>
<body>
${course_banner(course)}
<xi:include href="components/course.xhtml"/>
<head>
<title>${title}</title>
- <script type="text/javascript" src="/syrup/static/menublocks.js"/>
+ <script type="text/javascript" src="${ROOT}/static/menublocks.js"/>
</head>
<body>
${course_banner(course)}
app_name = _('Syrup E-Reserve System')
search = _('search...')
import os
-rooted = lambda url: request.META['SCRIPT_NAME'] + url
?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
<head py:attrs="select('@*')"
py:with="t=list(select('title/text()'))">
<title>${app_name}<py:if test="t">: ${t}</py:if></title>
- <link rel="stylesheet" type="text/css" href="${rooted('/static/main.css')}"/>
- <script type="text/javascript" src="${rooted('/static/jquery/js/jquery-1.3.2.min.js')}"/>
- <script type="text/javascript" src="${rooted('/static/jquery/js/jquery-ui-1.7.1.custom.min.js')}"/>
- <script type="text/javascript" src="${rooted('/static/jquery/js/jquery.tablesorter.min.js')}"/>
+ <link rel="stylesheet" type="text/css" href="${ROOT}/static/main.css"/>
+ <script type="text/javascript" src="${ROOT}/static/jquery/js/jquery-1.3.2.min.js"/>
+ <script type="text/javascript" src="${ROOT}/static/jquery/js/jquery-ui-1.7.1.custom.min.js"/>
+ <script type="text/javascript" src="${ROOT}/static/jquery/js/jquery.tablesorter.min.js"/>
${select('*[local-name()!="title"]')}
</head>
</py:match>
${os.getpid()}
${app_name}
</div>
- <img src="${rooted('/static/institution-logo.png')}" style="height: 50;"/>
+ <img src="${ROOT}/static/institution-logo.png" style="height: 50;"/>
</div>
<!--
<div id="header" py:if="user.is_authenticated()">
-->
<div id="header">
<div id="search">
- <form method="get" action="${rooted('/search')}"
+ <form method="get" action="${ROOT}/search"
onsubmit="if(q.value.replace(/^\s*/, '').replace(/\s*$/, '') =='') return false;"
>
<input id="q" name="q" maxlength="100" size="25" type="text"
</div>
<span py:if="user.is_authenticated()">
<strong style="padding-right: 18;">Welcome, ${user.first_name or user.username}!</strong>
- <a href="${rooted('/accounts/logout')}">Log Out</a>
- • <a href="${rooted('/prefs/')}">Preferences</a>
+ <a href="${ROOT}/accounts/logout">Log Out</a>
+ • <a href="${ROOT}/prefs/">Preferences</a>
</span>
<span py:if="not user.is_authenticated()">
<strong style="padding-right: 18;">Welcome!</strong>
- <a class="loginbutton" href="${rooted('/accounts/login/')}">Log In</a>
- • <a href="${rooted('/prefs/')}">Preferences</a>
+ <a class="loginbutton" href="${ROOT}/accounts/login/">Log In</a>
+ • <a href="${ROOT}/prefs/}">Preferences</a>
</span>
</div>
<xi:include py:if="user.is_authenticated()" href="tabbar.xhtml"/>
<h1>${title}</h1>
<h2>Preferred Language</h2>
<form action="../i18n/setlang/" method="post">
-<input name="next" type="hidden" value="/syrup/" />
+<input name="next" type="hidden" value="${ROOT}/" />
<select name="language">
<option py:for="code,descr in settings.LANGUAGES"
value="${code}">${_(descr)}</option>
use one for now
-->
<ul id="tabbar">
- <li><a href="${rooted('/')}">Home</a></li>
- <li><a href="${rooted('/browse/')}">Browse</a></li>
- <li class="active"><a href="${rooted('/course/')}">My Courses</a></li>
+ <li><a href="${ROOT}/">Home</a></li>
+ <li><a href="${ROOT}/browse/">Browse</a></li>
+ <li class="active"><a href="${ROOT}/course/">My Courses</a></li>
<div py:strip="True"
py:if="request.user.is_staff">
- <li><a href="${rooted('/admin/')}">Admin Options</a></li>
- <li><a href="${rooted('/phys/')}">Physical Items</a></li>
+ <li><a href="${ROOT}/admin/">Admin Options</a></li>
+ <li><a href="${ROOT}/phys/">Physical Items</a></li>
</div>
</ul>
</html>
use one for now
-->
<ul id="tabbar">
- <li><a href="/syrup/">Home</a></li>
- <li><a href="/syrup/browse/">Browse</a></li>
+ <li><a href="${ROOT}/">Home</a></li>
+ <li><a href="${ROOT}/browse/">Browse</a></li>
</ul>
</html>