# 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
]

class Result(object):
    def __init__(self, content, content_type, http_status=200, headers=None):
        self.content = content
        self.content_type = content_type
        self.http_status = http_status
        if not headers:
            headers = {}
        self.headers = headers

class RequestAwareRenderer(object):

    def __call__(self, req, result):
        pass


class Json(object):
    ''' Default Nudge HTTP Content Type. Encodes the entire endpoint
        result as json, and returns.

        Note this renderer will not allow you to pass back a top level
        list or tuple (javascript array) because it is insecure, and could
        allow a CSRF attack. See here:
        http://flask.pocoo.org/docs/security/#json-security
    '''
    def __call__(self, result):
        if result == None:
            raise HTTPException(404)
        if isinstance(result, (types.ListType, types.TupleType)):

# 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

]

class Result(object):
    def __init__(self, content, content_type, http_status=200, headers=None):
        self.content = content
        self.content_type = content_type
        self.http_status = http_status
        if not headers:
            headers = {}
        self.headers = headers

class RequestAwareRenderer(object):

    def __call__(self, req, result):
        pass


class Json(object):
    ''' Default Nudge HTTP Content Type. Encodes the entire endpoint
        result as json, and returns.

        Note this renderer will not allow you to pass back a top level
        list or tuple (javascript array) because it is insecure, and could
        allow a CSRF attack. See here:
        http://flask.pocoo.org/docs/security/#json-security
    '''
    def __call__(self, result):
        if result == None:
            raise HTTPException(404)
        if isinstance(result, (types.ListType, types.TupleType)):

            raise SecurityException(