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

« back to all changes in this revision

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

  • Committer: wagrant
  • Date: 2008-08-09 04:33:07 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:995
common.db: Add get_enrolment_groups. Will return group information for
           the given user in the given offering.
userservice: Return group information with the rest of the enrolment
             data.

Show diffs side-by-side

added added

removed removed

Lines of Context:
423
423
 
424
424
def handle_get_enrolments(req, fields):
425
425
    """
426
 
    Retrieve a user's enrolment details.
 
426
    Retrieve a user's enrolment details. Each enrolment includes any group
 
427
    memberships for that offering.
427
428
    """
428
429
    # For the moment we're only able to query ourselves
429
430
    fullpowers = False
445
446
    # Just talk direct to the DB
446
447
    db = common.db.DB()
447
448
    enrolments = db.get_enrolment(login)
 
449
    for e in enrolments:
 
450
        e['groups'] = db.get_enrolment_groups(login, e['offeringid'])
448
451
    db.close()
449
452
    response = cjson.encode(enrolments)
450
453
    req.content_type = "text/plain"