# Path: common/serialize.py
# def serialize(self, result):
#     text = ''
#     for r in result:
#         text += str(r) + ': ' + str(result[r]) + '\n'
#     return text


import sys
import json
import os
import random
    import cgi
        import traceback
from common import serialize
from get_credit import get_credit
    from flup.server.cgi import WSGIServer
# -*- coding: utf-8 -*-


class SerializerHtml(serialize.SerializerBase):
    def __init__(self, serializer_type):
        serialize.SerializerBase.__init__(self, serializer_type)

    def mime_type(self):
        return 'text/html'

    def serialize(self, result):
        html = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head></head>
<body>"""
        for r in result:
            html += str(r) + ': ' + str(result[r]) + '<br />'
        return html + "</body></html>"

def get_serializer(serializer_type):
    html_serializer = { 'html' : SerializerHtml }
    return serialize.get_serializer(serializer_type, html_serializer)

def split_param(params):
    if params:
        return params.split('|')
    return []

def query_params(environ):
    field = cgi.FieldStorage(fp = environ['wsgi.input'], environ = environ)

# Path: common/serialize.py
# def serialize(self, result):
#     text = ''
#     for r in result:
#         text += str(r) + ': ' + str(result[r]) + '\n'
#     return text


# Path: history_credit/credits.py
import sys
import json
import os
import random
    import cgi
        import traceback
from common import serialize
from get_credit import get_credit
    from flup.server.cgi import WSGIServer

# -*- coding: utf-8 -*-


class SerializerHtml(serialize.SerializerBase):
    def __init__(self, serializer_type):
        serialize.SerializerBase.__init__(self, serializer_type)

    def mime_type(self):
        return 'text/html'

    def serialize(self, result):
        html = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head></head>
<body>"""
        for r in result:
            html += str(r) + ': ' + str(result[r]) + '<br />'
        return html + "</body></html>"

def get_serializer(serializer_type):
    html_serializer = { 'html' : SerializerHtml }
    return serialize.get_serializer(serializer_type, html_serializer)

def split_param(params):
    if params:
        return params.split('|')
    return []

def query_params(environ):
    field = cgi.FieldStorage(fp = environ['wsgi.input'], environ = environ)

    rdict = { 'format' : 'text',