[Sun Jan 25 14:45:49 2009] [notice] Apache/2.2.9 (Ubuntu) mod_ssl/
2.2.9 OpenSSL/0.9.8g mod_wsgi/3.0-TRUNK Python/3.0 configured --
resuming normal operations
[Sun Jan 25 14:45:49 2009] [info] Server built: Sep 19 2008 13:43:21
[Sun Jan 25 14:46:07 2009] [info] [client 80.200.15.166] mod_wsgi
(pid=12799, process='', application=''): Loading WSGI script '/home/
www/appwsgi/www/lib/upload.py'.
[Sun Jan 25 14:46:07 2009] [error] ('SELECT uid,sid,exp FROM sessions
WHERE sid=? AND exp>?', ('75eac071151174f5', '2009-01-25 13:46:07'))
[Sun Jan 25 14:46:07 2009] [error] ('SELECT gid FROM groups WHERE
uid=? AND gid=?', ('gert', 'guest'))
[Sun Jan 25 14:46:07 2009] [error] ('UPDATE sessions SET exp=? WHERE
sid=? ', ('2009-01-25 14:46:07', '75eac071151174f5'))
[Sun Jan 25 14:46:07 2009] [info] mod_wsgi (pid=12867): Attach
interpreter ''.
[Sun Jan 25 14:46:07 2009] [info] mod_wsgi (pid=12867): Adding '/home/
www/appwsgi/www/lib' to path.
[Sun Jan 25 14:46:08 2009] [error] [client 80.200.15.166] mod_wsgi
(pid=12799): Exception occurred processing WSGI script '/home/www/
appwsgi/www/lib/upload.py'.
[Sun Jan 25 14:46:08 2009] [error] [client 80.200.15.166] Traceback
(most recent call last):
[Sun Jan 25 14:46:08 2009] [error] [client 80.200.15.166]   File "/
home/www/appwsgi/www/lib/upload.py", line 14, in application
[Sun Jan 25 14:46:08 2009] [error] [client 80.200.15.166]     s =
environ['wsgi.input'].read()
[Sun Jan 25 14:46:08 2009] [error] [client 80.200.15.166] SystemError:
Objects/bytesobject.c:3171: bad argument to internal function

it does not get to the print statemant crashes every time on 182 KB
and bigger specifying l always work
PS repr() does seem to get cut in the log files too

from db import Db
from session import Session
from re import search,DOTALL

def application(environ, response):
    db = Db()
    cookie = "SID="+environ['QUERY_STRING']
    session = Session(db,cookie,'guest')
    response('200 OK', [('Content-type', 'text/xml'), ('Set-Cookie',
session.COOKIE)])
    if not session.GID : return []
    l = int(environ.get("CONTENT_LENGTH", "0"))

    s = environ['wsgi.input'].read()
    print("TYPE=%s", type(data), file=environ["wsgi.errors"])
    print("DATA=%s", repr(data), file=environ["wsgi.errors"])

    s = s.decode('latin1')
    print("STRING=%s", repr(s), file=environ["wsgi.errors"])

    b = environ['CONTENT_TYPE'].split('boundary=')[1]
    b = '------------'+b
    p = search(r'Content-Type: application/octet-stream\r\n\r\n(.*?)\r
\n--',s,DOTALL).group(1)
    db.execute('UPDATE users SET picture=? WHERE uid=?',(p.encode
('latin1'),session.UID))
    xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
    xml+= "<root>"+str(db.ERROR)+"</root>"
    response('200 OK', [('Content-type', 'text/xml')])
    return [xml]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to