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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: William Grant
  • Date: 2009-05-05 02:57:53 UTC
  • Revision ID: grantw@unimelb.edu.au-20090505025753-a12zc1my6tjowies
Decode console input as UTF-8, until JSONRESTView does it for us.

Unicode input had regressed!

Show diffs side-by-side

added added

removed removed

Lines of Context:
435
435
        return "<%s %d in %r>" % (type(self).__name__, self.id,
436
436
                                  self.offering)
437
437
 
438
 
    def get_permissions(self, user):
439
 
        return self.offering.get_permissions(user)
440
 
 
441
438
class Project(Storm):
442
439
    """A student project for which submissions can be made."""
443
440
 
491
488
 
492
489
        return ps
493
490
 
494
 
    def get_permissions(self, user):
495
 
        return self.project_set.offering.get_permissions(user)
496
 
 
497
491
 
498
492
class ProjectGroup(Storm):
499
493
    """A group of students working together on a project."""
592
586
        return "<%s %r in %r>" % (type(self).__name__,
593
587
            self.user or self.project_group, self.project)
594
588
 
595
 
    @property
596
 
    def principal(self):
597
 
        return self.project_group or self.user
598
 
 
599
589
    @classmethod
600
590
    def get(cls, store, principal, project):
601
591
        """Find or create an Assessed for the given user or group and project.
704
694
            if user.admin:
705
695
                perms.add('edit')
706
696
                perms.add('view')
707
 
            elif u'lecturer' in set((e.role for e in user.active_enrolments)):
708
 
                perms.add('edit')
709
 
                perms.add('view')
710
 
            elif u'tutor' in set((e.role for e in user.active_enrolments)):
 
697
            elif 'lecturer' in set((e.role for e in user.active_enrolments)):
711
698
                perms.add('edit')
712
699
                perms.add('view')
713
700