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

« back to all changes in this revision

Viewing changes to lib/common/db.py

  • Committer: mattgiuca
  • Date: 2008-04-16 16:11:49 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:733
db.py: Added new function set_worksheet_assessable.
    Realised that if create_worksheet was used to update assessable, then
    mtime would be set to the current time, and therefore when you go to
    update based on the worksheet.xml, it will look like it's already
    up-to-date. BAD!!

    Therefore, you use set_worksheet_assessable to update the "assessable"
    field without setting the new mtime.

Show diffs side-by-side

added added

removed removed

Lines of Context:
744
744
            self.rollback()
745
745
            raise
746
746
 
 
747
    def set_worksheet_assessable(self, subject, worksheet, assessable,
 
748
        dry=False):
 
749
        """
 
750
        Sets the "assessable" field of a worksheet without updating the mtime.
 
751
 
 
752
        IMPORTANT: This will NOT update the mtime. This is designed to allow
 
753
        updates which did not come from the worksheet XML file. It would be
 
754
        bad to update the mtime without consulting the XML file because then
 
755
        it would appear the database is up to date, when it isn't.
 
756
 
 
757
        Therefore, call this method if you are getting "assessable"
 
758
        information from outside the worksheet XML file (eg. from the subject
 
759
        XML file).
 
760
 
 
761
        Unlike create_worksheet, raises a DBException if the worksheet is not
 
762
        in the database.
 
763
        """
 
764
        return self.update({"subject": subject, "identifier": worksheet},
 
765
            {"assessable": assessable}, "worksheet", ["assessable"],
 
766
            ["subject", "identifier"], dry=dry)
 
767
 
747
768
    def worksheet_is_assessable(self, subject, worksheet, dry=False):
748
769
        r = self.get_single(
749
770
            {"subject": subject, "identifier": worksheet},