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

« back to all changes in this revision

Viewing changes to ivle/util.py

Port the tos app to the new framework, and fix ivle.webapp.help's reference
to it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
            except ValueError:
178
178
                return "File"
179
179
 
180
 
def send_terms_of_service(req):
 
180
def get_terms_of_service():
181
181
    """
182
182
    Sends the Terms of Service document to the req object.
183
183
    This consults conf to find out where the TOS is located on disk, and sends
185
185
    how to create a real one.
186
186
    """
187
187
    try:
188
 
        req.sendfile(ivle.conf.tos_path)
 
188
        return open(ivle.conf.tos_path).read()
189
189
    except IOError:
190
 
        req.write(
191
 
"""<h1>Terms of Service</h1>
 
190
        return """<h1>Terms of Service</h1>
192
191
<p><b>*** SAMPLE ONLY ***</b></p>
193
192
<p>This is the text of the IVLE Terms of Service.</p>
194
193
<p>The administrator should create a license file with an appropriate
206
205
just be the contents of a body element (IVLE will wrap it accordingly).</p>
207
206
<p>This will automatically be used as the license text instead of this
208
207
placeholder text.</p>
209
 
""")
 
208
"""
210
209
 
211
210
def parse_iso8601(str):
212
211
    """Parses ISO8601 string into a datetime object."""