Skip to content

python3 porting? #37

@filefolder

Description

@filefolder

Hi, our webserver (and seiscomp instance) is now exclusively python3 which breaks webdc3. Anyone managed to successfully port over? For the most part something like 2to3 catches most of the changes but there are still a lot of encoding gremlins left over.

I'm particularly having trouble with the end of webinterface.py

    if isinstance(res_string, basestring):
        status = '200 OK'
        body = res_string
        return send_plain_response(status, body, start_response)

    elif hasattr(res_string, 'filename'):
        status = '200 OK'
        body = res_string
        return send_file_response(status, body, start_response)

    status = '200 OK'
    body = "\n".join(res_string)
    return send_plain_response(status, body, start_response)

I understand that 'basestring' should just be changed to 'str' in py3, but at that point the code won't run unless I encode the body variable in send_plain_response in wsgicomm.py (e.g. body = body.encode('utf-8')), but this then ends up breaking other stuff so I am thinking there is something else here.

Anyway, curious if someone has already done this and know a fix, and if not, fwiw, the demand is there. Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions