# Path: nudge/json.py
# def json_encode(o):
#     return _encoder.encode(o)
# 
# Path: nudge/error.py
# DEFAULT_ERROR_CODE = 500
# DEFAULT_ERROR_CONTENT_TYPE = "application/json; charset=UTF-8"
# DEFAULT_ERROR_CONTENT = '{"message": "%s", "code": %i}' % (
#     "Internal Server Error",
#     DEFAULT_ERROR_CODE,
# )
# class JsonErrorHandler(object):
# class HTTPError(Exception):
# class SecurityException(Exception):
#     def __call__(self, exp, req=None, log_assert=True):
# def handle_exception(exp, exp_handlers, default_handler=None):
#     def __init__(self, status_code, message=None):


import base64
import types
from cStringIO import StringIO
from nudge.json import json_encode
from nudge.error import HTTPException, SecurityException
    def __call__(self, uri, headers=None):
        return self.redirect(uri, self.http_status, headers)


class CSS(object):

    def __call__(self, content):
        return Result(
            content=content,
            content_type='text/css; charset=utf-8',
            http_status=200,
        )

class Img(object):

    # expects img.data, img.type
    def __call__(self, img):
        return Result(
            content=img.data,
            content_type="image" + img.type,
            http_status=200,
        )

class ImgOrRedirect(object):

    # expects {'img_url':url, 'data': img_data, 'content_type;: 'img/IMGTYPE'}
    def __call__(self, content):
        if content.data:
            return Result(
                content=content.data,

# Path: nudge/json.py
# def json_encode(o):
#     return _encoder.encode(o)
# 
# Path: nudge/error.py
# DEFAULT_ERROR_CODE = 500
# DEFAULT_ERROR_CONTENT_TYPE = "application/json; charset=UTF-8"
# DEFAULT_ERROR_CONTENT = '{"message": "%s", "code": %i}' % (
#     "Internal Server Error",
#     DEFAULT_ERROR_CODE,
# )
# class JsonErrorHandler(object):
# class HTTPError(Exception):
# class SecurityException(Exception):
#     def __call__(self, exp, req=None, log_assert=True):
# def handle_exception(exp, exp_handlers, default_handler=None):
#     def __init__(self, status_code, message=None):


# Path: nudge/renderer.py
import base64
import types
from cStringIO import StringIO
from nudge.json import json_encode
from nudge.error import HTTPException, SecurityException

    def __call__(self, uri, headers=None):
        return self.redirect(uri, self.http_status, headers)


class CSS(object):

    def __call__(self, content):
        return Result(
            content=content,
            content_type='text/css; charset=utf-8',
            http_status=200,
        )

class Img(object):

    # expects img.data, img.type
    def __call__(self, img):
        return Result(
            content=img.data,
            content_type="image" + img.type,
            http_status=200,
        )

class ImgOrRedirect(object):

    # expects {'img_url':url, 'data': img_data, 'content_type;: 'img/IMGTYPE'}
    def __call__(self, content):
        if content.data:
            return Result(
                content=content.data,

                content_type=content.content_type,