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

« back to all changes in this revision

Viewing changes to ivle/webapp/security/views.py

Added module ivle.config, which takes care of some work interfacing with
    configobj, including searching for the file and opening the object.
ivle.conf.conf now uses this instead of having its own search.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 
18
 
# App: Logout
19
 
# Author: Nick Chadwick
20
 
# Date: 13/01/2009
21
 
 
22
 
import cgi
23
 
from ivle import util
24
 
 
25
 
# url path for this app
26
 
THIS_APP = "logout"
27
 
 
28
 
def handle(req):
29
 
    if req.method == "POST":
30
 
        req.logout()
31
 
    else:
32
 
        req.write_html_head_foot = True
33
 
        req.content_type = "text/html"
34
 
        req.write('<div id="ivle_padding">\n'
35
 
                  '<h3>Are you sure you want to logout?</h3><p>'
36
 
                  '<form action="%s" method="POST">\n'
37
 
                  '    <input type="submit" value="Logout" />\n'
38
 
                  '</form>\n</div>\n' % (cgi.escape(util.make_path('logout'))))
 
18
# Author: Will Grant, Nick Chadwick
 
19
 
 
20
from ivle.webapp.base.xhtml import XHTMLView
 
21
import ivle.util
 
22
 
 
23
class LogoutView(XHTMLView):
 
24
    '''A view to log the current session out.'''
 
25
    template = 'logout.html'
 
26
 
 
27
    def populate(self, req, ctx):
 
28
        if req.method == "POST":
 
29
            req.logout()
 
30
        else:
 
31
            ctx['path'] =  ivle.util.make_path('logout')