# Path: shimehari/core/helpers.py
# def attachEnctypeErrorMultidict(request):
#     oldCls = request.files.__class__
# 
#     class newCls(oldCls):
#         def __getitem__(self, key):
#             try:
#                 return oldCls.__getitem__(self, key)
#             except KeyError, e:
#                 if key not in request.form:
#                     raise
#                 raise DebugFilesKeyError(request, key)
#     newCls.__name__ = oldCls.__name__
#     newCls.__module__ = oldCls.__module__
#     request.files.__class__ = newCls
# 
# Path: shimehari/core/exceptions.py
# class JSONBadRequest(JSONHTTPExceptions, BadRequest):
#     description = ('ブラウザ、もしくはプロクシが送ったリクエストを、このアプリケーションでは処理できません。')
# 
# Path: shimehari/helpers.py
# def _assertHaveJson():
# def _assertHaveRedis():
# def getHandlerAction(resource, action):
# def getHostName(url):
#     def __init__(self):
#     def strip(self, htmlTag):
#     def handle_data(self, data):
# def urlFor(endpoint, **values):
# def findPackage(importName):
# def getModulesFromPyFile(targetPath, rootPath):
# def getRootPath(importName):
# def getEnviron():
# def sendFromDirectory(directory, filename, **options):
# def safeJoin(directory, filename):
# def sendFile(filenameOrFp, mimetype=None, asAttachment=False,
#              attachmentFilename=None, addEtags=True,
#              cacheTimeout=None, conditional=False):
# def jsonify(*args, **kwargs):
# def fillSpace(text, length):
#     def __init__(self, func, name=None, doc=None):
#     def __get__(self, obj, type=None):
# def getTemplater(app, templaterName, *args, **options):
# def flash(message, category='message'):
# def getFlashedMessage(withCategory=False, categoryFilter=[]):
#     def __init__(self, importName, appFolder='app',
#                   controllerFolder='controllers', viewFolder=None):
#         def _assetsURL(self):
#     def getStaticFolder(self, key):
#     def setStaticFolder(self, value):
#     def getStaticFolders(self):
#     def setStaticFolders(self, **folders):
#     def getStaticURL(self, key):
#     def setStaticURL(self, value):
#     def getStaticURLs(self):
#     def setStaticURLs(self, **urls):
#     def hasStaticFolder(self):
#     def sendStaticFile(self, filename):
#     def getSendFileMaxAge(self, filename):
#     def openFile(self, filename, mode='rb'):
# class Stripper(sgmllib.SGMLParser):
# class lockedCachedProperty(object):
# class _Kouzi(object):
# 
# Path: shimehari/shared.py
# class _SharedRequestClass(object):
# def _lookUpObjectInRequestContext(name):
# def findApp():


from werkzeug.utils import cached_property
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
from shimehari.core.helpers import attachEnctypeErrorMultidict
from shimehari.core.exceptions import JSONBadRequest
from shimehari.helpers import _assertHaveJson, json
from shimehari.shared import _requestContextStack
#!/usr/bin/env python
# -*- coding: utf-8 -*-

u"""
===============================
    Shimehari.wrappers
    ~~~~~~~~~~~~~~~~~~
    リクエストやらレスポンスやら

===============================
"""



class Request(RequestBase):
    urlRule = None
    viewArgs = None

    routingException = None

    @property
    def endpoint(self):
        if self.urlRule is not None:
            return self.urlRule.endpoint

    @cached_property

# Path: shimehari/core/helpers.py
# def attachEnctypeErrorMultidict(request):
#     oldCls = request.files.__class__
# 
#     class newCls(oldCls):
#         def __getitem__(self, key):
#             try:
#                 return oldCls.__getitem__(self, key)
#             except KeyError, e:
#                 if key not in request.form:
#                     raise
#                 raise DebugFilesKeyError(request, key)
#     newCls.__name__ = oldCls.__name__
#     newCls.__module__ = oldCls.__module__
#     request.files.__class__ = newCls
# 
# Path: shimehari/core/exceptions.py
# class JSONBadRequest(JSONHTTPExceptions, BadRequest):
#     description = ('ブラウザ、もしくはプロクシが送ったリクエストを、このアプリケーションでは処理できません。')
# 
# Path: shimehari/helpers.py
# def _assertHaveJson():
# def _assertHaveRedis():
# def getHandlerAction(resource, action):
# def getHostName(url):
#     def __init__(self):
#     def strip(self, htmlTag):
#     def handle_data(self, data):
# def urlFor(endpoint, **values):
# def findPackage(importName):
# def getModulesFromPyFile(targetPath, rootPath):
# def getRootPath(importName):
# def getEnviron():
# def sendFromDirectory(directory, filename, **options):
# def safeJoin(directory, filename):
# def sendFile(filenameOrFp, mimetype=None, asAttachment=False,
#              attachmentFilename=None, addEtags=True,
#              cacheTimeout=None, conditional=False):
# def jsonify(*args, **kwargs):
# def fillSpace(text, length):
#     def __init__(self, func, name=None, doc=None):
#     def __get__(self, obj, type=None):
# def getTemplater(app, templaterName, *args, **options):
# def flash(message, category='message'):
# def getFlashedMessage(withCategory=False, categoryFilter=[]):
#     def __init__(self, importName, appFolder='app',
#                   controllerFolder='controllers', viewFolder=None):
#         def _assetsURL(self):
#     def getStaticFolder(self, key):
#     def setStaticFolder(self, value):
#     def getStaticFolders(self):
#     def setStaticFolders(self, **folders):
#     def getStaticURL(self, key):
#     def setStaticURL(self, value):
#     def getStaticURLs(self):
#     def setStaticURLs(self, **urls):
#     def hasStaticFolder(self):
#     def sendStaticFile(self, filename):
#     def getSendFileMaxAge(self, filename):
#     def openFile(self, filename, mode='rb'):
# class Stripper(sgmllib.SGMLParser):
# class lockedCachedProperty(object):
# class _Kouzi(object):
# 
# Path: shimehari/shared.py
# class _SharedRequestClass(object):
# def _lookUpObjectInRequestContext(name):
# def findApp():


# Path: shimehari/wrappers.py
from werkzeug.utils import cached_property
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
from shimehari.core.helpers import attachEnctypeErrorMultidict
from shimehari.core.exceptions import JSONBadRequest
from shimehari.helpers import _assertHaveJson, json
from shimehari.shared import _requestContextStack

#!/usr/bin/env python
# -*- coding: utf-8 -*-

u"""
===============================
    Shimehari.wrappers
    ~~~~~~~~~~~~~~~~~~
    リクエストやらレスポンスやら

===============================
"""



class Request(RequestBase):
    urlRule = None
    viewArgs = None

    routingException = None

    @property
    def endpoint(self):
        if self.urlRule is not None:
            return self.urlRule.endpoint

    @cached_property

    def json(self):