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

1076 by chadnickbok
Created a new app, logout, which when given a GET
1
# IVLE
2
# Copyright (C) 2007-2009 The University of Melbourne
3
#
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18
# App: Logout
19
# Author: Nick Chadwick
20
# Date: 13/01/2009
21
1079 by William Grant
Merge setup-refactor branch. This completely breaks existing installations;
22
from ivle import util
1076 by chadnickbok
Created a new app, logout, which when given a GET
23
1093 by chadnickbok
Adding the changes from my genshi branch into trunk.
24
import genshi
25
import genshi.template
26
1076 by chadnickbok
Created a new app, logout, which when given a GET
27
# url path for this app
28
THIS_APP = "logout"
29
30
def handle(req):
31
    if req.method == "POST":
32
        req.logout()
33
    else:
1093 by chadnickbok
Adding the changes from my genshi branch into trunk.
34
        req.content_type = "text/html"
1076 by chadnickbok
Created a new app, logout, which when given a GET
35
        req.write_html_head_foot = True
1093 by chadnickbok
Adding the changes from my genshi branch into trunk.
36
        ctx = genshi.template.Context()
37
        ctx['path'] =  util.make_path('logout')
38
        loader = genshi.template.TemplateLoader(".", auto_reload=True)
39
        tmpl = loader.load(util.make_local_path("apps/logout/template.html"))
40
        req.write(tmpl.generate(ctx).render('html')) #'xhtml', doctype='xhtml'))