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

« back to all changes in this revision

Viewing changes to www/apps/logout/__init__.py

  • Committer: chadnickbok
  • Date: 2009-02-02 04:00:25 UTC
  • Revision ID: svn-v4:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1189
Adding the changes from my genshi branch into trunk.

Most apps now use the Genshi templating engine, in preparation
for future changes to dispatch

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
# Author: Nick Chadwick
20
20
# Date: 13/01/2009
21
21
 
22
 
import cgi
23
22
from ivle import util
24
23
 
 
24
import genshi
 
25
import genshi.template
 
26
 
25
27
# url path for this app
26
28
THIS_APP = "logout"
27
29
 
29
31
    if req.method == "POST":
30
32
        req.logout()
31
33
    else:
 
34
        req.content_type = "text/html"
32
35
        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'))))
 
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'))