return _access_denied(_('Only instructors are allowed here.'))
return hdlr
-
# decorator
def members_only(handler):
def hdlr(request, course_id, *args, **kwargs):
- allowed = request.user.is_superuser
+ user = request.user
+ allowed = user.is_superuser
if not allowed:
course = models.Course.objects.get(pk=course_id)
- allowed = ((request.user.is_anonymous and course.access=='ANON') or \
- (request.user.is_authenticated and course.access=='LOGIN'))
+ allowed = ((user.is_anonymous and course.access=='ANON') or \
+ (user.is_authenticated and course.access=='LOGIN'))
if not allowed:
- allowed = _fast_user_membership_query(request.user.id, course_id)
+ allowed = _fast_user_membership_query(user.id, course_id)
if allowed:
return handler(request, course_id, *args, **kwargs)
else:
def user_prefs(request):
- return g.render('simplemessage.xhtml',
- title=_('Sorry...'),
- content=_('The Preferences page isn\'t ready yet.'))
+ # for now, just send to the 'setlang' page. Better than 'under construction.'
+ return HttpResponseRedirect('../setlang')
def z3950_test(request):
conn = zoom.Connection ('z3950.loc.gov', 7090)
<span py:if="user.is_authenticated()">
<strong style="padding-right: 18;">Welcome, ${user.first_name or user.username}!</strong>
<a href="/accounts/logout">Log Out</a>
- • <a href="/syrup/setlang">Language</a>
• <a href="/syrup/prefs/">Preferences</a>
</span>
<span py:if="not user.is_authenticated()">
<strong style="padding-right: 18;">Welcome!</strong>
<a class="loginbutton" href="/accounts/login/">Log In</a>
- <a style="margin-left: 24;" href="/syrup/setlang">Language</a>
+ • <a href="/syrup/prefs/">Preferences</a>
</span>
</div>
<xi:include py:if="user.is_authenticated()" href="tabbar.xhtml"/>