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

« back to all changes in this revision

Viewing changes to ivle/webapp/userservice/__init__.py

  • Committer: William Grant
  • Date: 2010-02-16 03:26:03 UTC
  • Revision ID: grantw@unimelb.edu.au-20100216032603-b4wivzgux5ffaz8y
Purge userservice's unused get_active_offerings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
# Required cap: None (for yourself)
61
61
# Returns a JSON encoded listing of a students is enrollments
62
62
 
63
 
# userservice/get_active_offerings(req, fields):
64
 
# Required cap: None
65
 
# Returns all the active offerings for a particular subject
66
 
# Required:
67
 
#   subjectid
68
 
 
69
63
# PROJECTS AND GROUPS
70
64
 
71
65
# userservice/get_project_groups
338
332
    req.content_type = "text/plain"
339
333
    req.write(response)
340
334
 
341
 
def handle_get_active_offerings(req, fields):
342
 
    """Required cap: None
343
 
    Returns all the active offerings for a particular subject
344
 
    Required:
345
 
        subjectid
346
 
    """
347
 
 
348
 
    subjectid = fields.getfirst('subjectid')
349
 
    if subjectid is None:
350
 
        raise BadRequest("Required: subjectid")
351
 
    try:
352
 
        subjectid = int(subjectid)
353
 
    except:
354
 
        raise BadRequest("subjectid must be an integer")
355
 
 
356
 
    subject = req.store.get(ivle.database.Subject, subjectid)
357
 
 
358
 
    response = cjson.encode([{'offeringid': offering.id,
359
 
                              'subj_name': offering.subject.name,
360
 
                              'year': offering.semester.year,
361
 
                              'semester': offering.semester.semester,
362
 
                              'active': True # XXX: Eliminate from protocol.
363
 
                             } for offering in subject.offerings
364
 
                                    if offering.semester.state == 'current'])
365
 
    req.content_type = "text/plain"
366
 
    req.write(response)
367
 
 
368
335
def handle_get_project_groups(req, fields):
369
336
    """Required cap: None
370
337
    Returns all the project groups in an offering grouped by project set
600
567
    "activate_me": handle_activate_me,
601
568
    "create_user": handle_create_user,
602
569
    "get_enrolments": handle_get_enrolments,
603
 
    "get_active_offerings": handle_get_active_offerings,
604
570
    "get_project_groups": handle_get_project_groups,
605
571
    "get_group_membership": handle_get_group_membership,
606
572
    "create_group": handle_create_group,