# Path: gap/conf.py
#     DEFAULT_SETTINGS = {}
#     KEY = 'app_settings'
# class AppSettings(ndb.Expando):
# class LazyAppSettings(object):
# class SettingsDict(object):
#     def get_key(cls):
#     def put(self, *args, **kwargs):
#     def get_uuid(cls):
#     def set_uuid(cls):
#     def __get__(self, instance, owner=None):
#     def _set_settings(self, dict_data):
#     def __getitem__(self, key):
#                 def new_setter(obj, key, value):
#     def __setitem__(self, key, value):
#     def add_setting(self, key, value):
#     def save(self):
#     def reload(self):
#     def del_setting(self, key):
#     def __hasitem__(self, key):
#     def __contains__(self, key):
#     def keys(self):
#     def items(self):
#     def values(self):
#     def __iter__(self):


import logging
import json
import time
from gap.conf import settings
from datetime import datetime, date
        from httplib import responses
                from traceback import format_exc

class MessageEncoder(json.JSONEncoder):

    def default(self, o):
        if hasattr(o, 'as_dict'):
            return o.as_dict()
        elif hasattr(o, 'to_dict'):
            return o.to_dict()
        elif isinstance(o, (date, datetime)):
            return time.mktime(o.timetuple())
        else:
            super(MessageEncoder, self).default(o)


class dumps(object):

    def __init__(self, data, **kwargs):
        self._data = data
        self.kwargs = kwargs

    def __str__(self):
        return self._dumps()

    def __unicode__(self):
        return unicode(self._dumps())

    def _dumps(self):
        return json.dumps(self._data, cls=MessageEncoder, **self.kwargs)



# Path: gap/conf.py
#     DEFAULT_SETTINGS = {}
#     KEY = 'app_settings'
# class AppSettings(ndb.Expando):
# class LazyAppSettings(object):
# class SettingsDict(object):
#     def get_key(cls):
#     def put(self, *args, **kwargs):
#     def get_uuid(cls):
#     def set_uuid(cls):
#     def __get__(self, instance, owner=None):
#     def _set_settings(self, dict_data):
#     def __getitem__(self, key):
#                 def new_setter(obj, key, value):
#     def __setitem__(self, key, value):
#     def add_setting(self, key, value):
#     def save(self):
#     def reload(self):
#     def del_setting(self, key):
#     def __hasitem__(self, key):
#     def __contains__(self, key):
#     def keys(self):
#     def items(self):
#     def values(self):
#     def __iter__(self):


# Path: gap/utils/json_utils.py
import logging
import json
import time
from gap.conf import settings
from datetime import datetime, date
        from httplib import responses
                from traceback import format_exc


class MessageEncoder(json.JSONEncoder):

    def default(self, o):
        if hasattr(o, 'as_dict'):
            return o.as_dict()
        elif hasattr(o, 'to_dict'):
            return o.to_dict()
        elif isinstance(o, (date, datetime)):
            return time.mktime(o.timetuple())
        else:
            super(MessageEncoder, self).default(o)


class dumps(object):

    def __init__(self, data, **kwargs):
        self._data = data
        self.kwargs = kwargs

    def __str__(self):
        return self._dumps()

    def __unicode__(self):
        return unicode(self._dumps())

    def _dumps(self):
        return json.dumps(self._data, cls=MessageEncoder, **self.kwargs)



def json_response(fn):