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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: Matt Giuca
  • Date: 2010-07-20 12:52:34 UTC
  • mto: This revision was merged to the branch mainline in revision 1818.
  • Revision ID: matt.giuca@gmail.com-20100720125234-o1o4os66jr5u3xoq
ivle.database: Project.submit now has a 'late' parameter which, if True, will disregard the project's deadline (to allow for late submissions).

Show diffs side-by-side

added added

removed removed

Lines of Context:
610
610
        return "<%s '%s' in %r>" % (type(self).__name__, self.short_name,
611
611
                                  self.project_set.offering)
612
612
 
613
 
    def can_submit(self, principal, user):
 
613
    def can_submit(self, principal, user, late=False):
 
614
        """
 
615
        @param late: If True, does not take the deadline into account.
 
616
        """
614
617
        return (self in principal.get_projects() and
615
 
                not self.has_deadline_passed(user))
 
618
                (late or not self.has_deadline_passed(user)))
616
619
 
617
 
    def submit(self, principal, path, revision, who):
 
620
    def submit(self, principal, path, revision, who, late=False):
618
621
        """Submit a Subversion path and revision to a project.
619
622
 
620
623
        @param principal: The owner of the Subversion repository, and the
622
625
        @param path: A path within that repository to submit.
623
626
        @param revision: The revision of that path to submit.
624
627
        @param who: The user who is actually making the submission.
 
628
        @param late: If True, will not raise a DeadlinePassed exception even
 
629
            after the deadline. (Default False.)
625
630
        """
626
631
 
627
 
        if not self.can_submit(principal, who):
 
632
        if not self.can_submit(principal, who, late=late):
628
633
            raise DeadlinePassed()
629
634
 
630
635
        a = Assessed.get(Store.of(self), principal, self)