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

« back to all changes in this revision

Viewing changes to ivle/util.py

  • Committer: William Grant
  • Date: 2009-04-28 04:51:45 UTC
  • Revision ID: grantw@unimelb.edu.au-20090428045145-17gkpb7dd5bv0e11
Move ivle.util.get_terms_of_service to ivle.webapp.tos.

Also make it use a configobj.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
            except ValueError:
153
153
                return "File"
154
154
 
155
 
def get_terms_of_service():
156
 
    """
157
 
    Sends the Terms of Service document to the req object.
158
 
    This consults conf to find out where the TOS is located on disk, and sends
159
 
    that. If it isn't found, it sends a generic message explaining to admins
160
 
    how to create a real one.
161
 
    """
162
 
    try:
163
 
        return open(ivle.conf.tos_path).read()
164
 
    except IOError:
165
 
        return """\
166
 
<p><b>*** SAMPLE ONLY ***</b></p>
167
 
<p>This is the text of the IVLE Terms of Service.</p>
168
 
<p>The administrator should create a license file with an appropriate
169
 
"Terms of Service" license for your organisation.</p>
170
 
<h2>Instructions for Administrators</h2>
171
 
<p>You are seeing this message because you have not configured a Terms of
172
 
Service document.</p>
173
 
<p>When you configured IVLE, you specified a path to the Terms of Service
174
 
document (this is found in <b><tt>ivle/conf/conf.py</tt></b> under
175
 
"<tt>tos_path</tt>").</p>
176
 
<p>Create a file at this location; an HTML file with the appropriately-worded
177
 
license.</p>
178
 
<p>This should be a normal XHTML file, except it should not contain
179
 
<tt>html</tt>, <tt>head</tt> or <tt>body</tt> elements - it should
180
 
just be the contents of a body element (IVLE will wrap it accordingly).</p>
181
 
<p>This will automatically be used as the license text instead of this
182
 
placeholder text.</p>
183
 
"""
184
 
 
185
155
def incomplete_utf8_sequence(byteseq):
186
156
    """
187
157
    str -> int