vendor/tramline

changeset 12:c77f592b081f gracinet-progress-bar

Simple handler to request progress info
author gracinet
date Sun, 22 Feb 2009 20:30:22 +0000
parents 0075e64fe07e
children 57410de1cafa
files src/tramline/progress.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line diff
     1.1 new file mode 100644
     1.2 --- /dev/null
     1.3 +++ b/src/tramline/progress.py
     1.4 @@ -0,0 +1,12 @@
     1.5 +from mod_python import apache
     1.6 +from tramline.core import get_progress
     1.7 +
     1.8 +def handler(req):
     1.9 +    progress_id = req.uri.rsplit('/', 1)[-1]
    1.10 +    uploaded = get_progress(req, progress_id)
    1.11 +    if uploaded is None:
    1.12 +        req.status = apache.HTTP_NOT_FOUND
    1.13 +    else:
    1.14 +        req.write(str(uploaded))
    1.15 +    req.content_type = "text/plain"
    1.16 +    return apache.OK