[open-ils-commits] r165 - servres/trunk/conifer/syrup (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Mar 9 22:56:50 EDT 2009
Author: gfawcett
Date: 2009-03-09 22:56:48 -0400 (Mon, 09 Mar 2009)
New Revision: 165
Modified:
servres/trunk/conifer/syrup/generics.py
servres/trunk/conifer/syrup/views.py
Log:
tweaks and documentation.
Modified: servres/trunk/conifer/syrup/generics.py
===================================================================
--- servres/trunk/conifer/syrup/generics.py 2009-03-10 02:44:47 UTC (rev 164)
+++ servres/trunk/conifer/syrup/generics.py 2009-03-10 02:56:48 UTC (rev 165)
@@ -25,7 +25,7 @@
instance = None
else:
instance = get_object_or_404(form.Meta.model, pk=obj_id)
- if request.method == 'GET':
+ if request.method != 'POST':
form = form(instance=instance)
return g.render('generic/edit.xhtml', **locals())
else:
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2009-03-10 02:44:47 UTC (rev 164)
+++ servres/trunk/conifer/syrup/views.py 2009-03-10 02:56:48 UTC (rev 165)
@@ -115,6 +115,8 @@
content=message,
_django_type=HttpResponseForbidden)
+# todo, these decorators could be refactored.
+
# decorator
def instructors_only(handler):
def hdlr(request, course_id, *args, **kwargs):
@@ -343,13 +345,17 @@
@instructors_only
def edit_course_permissions(request, course_id):
course = get_object_or_404(models.Course, pk=course_id)
+ # choices: make the access-choice labels more personalized than
+ # the ones in 'models'.
choices = [
+ # note: I'm leaving ANON out for now, until we discuss it further.
(u'CLOSE', _(u'No students: this site is closed.')),
(u'STUDT', _(u'Students in my course -- I will provide section numbers')),
(u'INVIT', _(u'Students in my course -- I will share an Invitation Code with them')),
(u'LOGIN', _(u'All Reserves patrons'))]
if models.course_sections.sections_tuple_delimiter is None:
- del choices[1] # no STUDT support.
+ # no course-sections support? Then STUDT cannot be an option.
+ del choices[1]
choose_access = django.forms.Select(choices=choices)
if request.method != 'POST':
@@ -549,7 +555,7 @@
assert item_type in ('HEADING', 'URL', 'ELEC'), \
_('Sorry, only HEADINGs, URLs and ELECs can be added right now.')
- if request.method == 'GET':
+ if request.method != 'POST':
item = models.Item() # dummy object
return g.render('item_add_%s.xhtml' % item_type.lower(),
**locals())
@@ -621,7 +627,7 @@
item_type = item.item_type
template = 'item_add_%s.xhtml' % item_type.lower()
parent_item = item.parent_heading
- if request.method == 'GET':
+ if request.method != 'POST':
return g.render(template, **locals())
else:
if 'file' in request.FILES:
More information about the open-ils-commits
mailing list