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

« back to all changes in this revision

Viewing changes to lib/common/util.py

  • Committer: mattgiuca
  • Date: 2008-03-09 11:48:29 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:673
Rebuilt the way Terms of Service are displayed:
    Delegated displaying TOS to util.send_terms_of_service.
    dispatch/login.py and apps/tos now call this instead of doing it
    themselves.

setup.py: Added tos_path to config options.
util.py: Added send_terms_of_service. Reads the TOS file from the configured
    location, and if it isn't there, the code itself sends a default TOS
    message to administrators (note: used to be a default file, now there IS
    NO DEFAULT TOS file. This is so that it won't get blown away upon
    reinstall).
Removed apps/tos/license.html. Now admins are expected to create their own TOS
file. It explains how to do this in the TOS if there isn't one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
                return filename[filename.rindex('.')+1:].upper() + " file"
135
135
            except ValueError:
136
136
                return "File"
 
137
 
 
138
def send_terms_of_service(req):
 
139
    """
 
140
    Sends the Terms of Service document to the req object.
 
141
    This consults conf to find out where the TOS is located on disk, and sends
 
142
    that. If it isn't found, it sends a generic message explaining to admins
 
143
    how to create a real one.
 
144
    """
 
145
    try:
 
146
        req.sendfile(conf.tos_path)
 
147
    except IOError:
 
148
        req.write(
 
149
"""<h1>Terms of Service</h1>
 
150
<p><b>*** SAMPLE ONLY ***</b></p>
 
151
<p>This is the text of the IVLE Terms of Service.</p>
 
152
<p>The administrator should create a license file with an appropriate
 
153
"Terms of Service" license for your organisation.</p>
 
154
<h2>Instructions for Administrators</h2>
 
155
<p>You are seeing this message because you have not configured a Terms of
 
156
Service document.</p>
 
157
<p>When you configured IVLE, you specified a path to the Terms of Service
 
158
document (this is found in <b><tt>lib/conf/conf.py</tt></b> under
 
159
"<tt>tos_path</tt>").</p>
 
160
<p>Create a file at this location; an HTML file with the appropriately-worded
 
161
license.</p>
 
162
<p>This should be a normal XHTML file, except it should not contain
 
163
<tt>html</tt>, <tt>head</tt> or <tt>body</tt> elements - it should
 
164
just be the contents of a body element (IVLE will wrap it accordingly).</p>
 
165
<p>This will automatically be used as the license text instead of this
 
166
placeholder text.</p>
 
167
""")