~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/apps/tutorial/__init__.py

  • Committer: me at id
  • Date: 2009-01-15 06:11:02 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:branches%2Fstorm:1163
www/app/{subjects,tutorial}: Use the new Storm API to get enrolled subjects.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
from ivle import util
43
43
import ivle.conf
44
44
import ivle.db
 
45
import ivle.database
45
46
 
46
47
from rst import rst
47
48
 
150
151
  Please select a subject from the list below to select a worksheet
151
152
  for that subject.</p>\n""")
152
153
 
153
 
    (enrolled_subjects, unenrolled_subjects) = \
154
 
              ivle.db.DB().get_subjects_status(req.user.login)
 
154
    enrolled_subjects = req.user.subjects
 
155
    unenrolled_subjects = [subject for subject in
 
156
                           req.store.find(ivle.database.Subject)
 
157
                           if subject not in enrolled_subjects]
155
158
 
156
159
    def print_subject(subject):
157
160
        req.write('  <li><a href="%s">%s</a></li>\n'
158
 
            % (urllib.quote(subject['subj_code']) + '/',
159
 
               cgi.escape(subject['subj_name'])))
 
161
            % (urllib.quote(subject.code) + '/',
 
162
               cgi.escape(subject.name)))
160
163
 
161
164
    req.write("<h2>Subjects</h2>\n<ul>\n")
162
165
    for subject in enrolled_subjects: