File: index.py

package info (click to toggle)
twms 0.05t-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 284 kB
  • ctags: 222
  • sloc: python: 1,647; sh: 79; makefile: 22
file content (30 lines) | stat: -rw-r--r-- 779 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
#    This file is part of twms.

# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://www.wtfpl.net/ for more details.

import twms


if __name__ != '__main__':
 try: 
  from mod_python import apache, util
  import datetime  
 except ImportError:
   pass

 
def handler(req):
    """
    A handler for mod_python.
    """
    data = util.FieldStorage(req)
    data = dict((k.lower(), v) for k, v in data.iteritems())
    resp, ctype, content = twms.twms_main(data)
    req.content_type = ctype
    req.write(content)
    return resp