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

« back to all changes in this revision

Viewing changes to lib/common/util.py

  • Committer: dcoles
  • Date: 2008-08-18 04:34:11 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1021
Database: Adds active column to problem_attempt table.
This allows a group of problem attempts (ie. from previous semesters) to be
marked as 'inactive' and thus counting toward a problem being assessment for
the current semester.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
import os
27
27
import mimetypes
 
28
import datetime
28
29
 
29
30
import conf
30
31
import conf.mimetypes
47
48
        self.message = message
48
49
        self.args = (httpcode, message)
49
50
 
 
51
class IVLEJailError(Exception):
 
52
    """
 
53
    This exception indicates an error that occurred inside an IVLE CGI script
 
54
    inside the jail. It should never be raised directly - only by the 
 
55
    interpreter.
 
56
 
 
57
    Information will be retrieved from it, and then treated as a normal
 
58
    error.
 
59
    """
 
60
    def __init__(self, type_str, message, info):
 
61
        self.type_str = type_str
 
62
        self.message = message
 
63
        self.info = info
 
64
 
50
65
def make_path(path):
51
66
    """Given a path relative to the IVLE root, makes the path relative to the
52
67
    site root using conf.root_dir. This path can be used in URLs sent to the
183
198
<p>This will automatically be used as the license text instead of this
184
199
placeholder text.</p>
185
200
""")
 
201
 
 
202
def parse_iso8601(str):
 
203
    """Parses ISO8601 string into a datetime object."""
 
204
    # FIXME: Terrific hack that means we only accept the format that is 
 
205
    # produced by json.js module when it encodes date objects.
 
206
    return datetime.datetime.strptime(str, "%Y-%m-%dT%H:%M:%SZ")
 
207