ó
`¾Tc           @   sž   d  Z  d d l m Z m Z d d l m Z d d l m	 Z	 d d l
 m Z d d l m Z e ƒ  Z d „  Z d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d S(   s¿   
    flask.wrappers
    ~~~~~~~~~~~~~~

    Implements the WSGI wrappers (request and response).

    :copyright: (c) 2011 by Armin Ronacher.
    :license: BSD, see LICENSE for more details.
iÿÿÿÿ(   t   Requestt   Response(   t
   BadRequesti   (   t   attach_enctype_error_multidict(   t   json(   t   _request_ctx_stackc         C   s2   t  |  d d  ƒ } | d  k	 r+ | d | ƒ S|  j S(   Nt   get_datat   cache(   t   getattrt   Nonet   data(   t   reqR   t   getter(    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyt	   _get_data   s    R    c           B   s•   e  Z d  Z d	 Z d	 Z d	 Z e Z e	 d „  ƒ Z
 e	 d „  ƒ Z e	 d „  ƒ Z e	 d „  ƒ Z e	 d „  ƒ Z e e e d „ Z d „  Z d „  Z RS(
   sÎ  The request object used by default in Flask.  Remembers the
    matched endpoint and view arguments.

    It is what ends up as :class:`~flask.request`.  If you want to replace
    the request object used you can subclass this and set
    :attr:`~flask.Flask.request_class` to your subclass.

    The request object is a :class:`~werkzeug.wrappers.Request` subclass and
    provides all of the attributes Werkzeug defines plus a few Flask
    specific ones.
    c         C   s'   t  j } | d k	 r# | j j d Sd S(   s6   Read-only view of the `MAX_CONTENT_LENGTH` config key.t   MAX_CONTENT_LENGTHN(   R   t   topR	   t   appt   config(   t   selft   ctx(    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyt   max_content_length@   s    	c         C   s   |  j  d k	 r |  j  j Sd S(   sè   The endpoint that matched the request.  This in combination with
        :attr:`view_args` can be used to reconstruct the same or a
        modified URL.  If an exception happened when matching, this will
        be `None`.
        N(   t   url_ruleR	   t   endpoint(   R   (    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyR   G   s    c         C   s:   d d l  m } | t d ƒ d d ƒ|  j r6 |  j Sd S(   s¥   The name of the current module if the request was dispatched
        to an actual module.  This is deprecated functionality, use blueprints
        instead.
        iÿÿÿÿ(   t   warnsO   modules were deprecated in favor of blueprints.  Use request.blueprint instead.t
   stackleveli   N(   t   warningsR   t   DeprecationWarningt   _is_old_modulet	   blueprint(   R   R   (    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyt   moduleQ   s
    	c         C   s9   |  j  r5 d |  j  j k r5 |  j  j j d d ƒ d Sd S(   s!   The name of the current blueprintt   .i   i    N(   R   R   t   rsplit(   R   (    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyR   ^   s    c         C   s
   |  j  ƒ  S(   s»   If the mimetype is `application/json` this will contain the
        parsed JSON data.  Otherwise this will be `None`.

        The :meth:`get_json` method should be used instead.
        (   t   get_json(   R   (    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyR   d   s    c         C   sÞ   t  |  d t ƒ } | t k	 r" | S|  j d k r< | r< d S|  j j d ƒ } yF t |  | ƒ } | d k	 r„ t j | d | ƒ} n t j | ƒ } Wn1 t	 k
 rÇ } | rµ d } qÈ |  j
 | ƒ } n X| rÚ | |  _ n  | S(   sx  Parses the incoming JSON request data and returns it.  If
        parsing fails the :meth:`on_json_loading_failed` method on the
        request object will be invoked.  By default this function will
        only load the json data if the mimetype is ``application/json``
        but this can be overriden by the `force` parameter.

        :param force: if set to `True` the mimetype is ignored.
        :param silent: if set to `False` this method will fail silently
                       and return `False`.
        :param cache: if set to `True` the parsed JSON data is remembered
                      on the request.
        t   _cached_jsons   application/jsont   charsett   encodingN(   R   t   _missingt   mimetypeR	   t   mimetype_paramst   getR   R   t   loadst
   ValueErrort   on_json_loading_failedR!   (   R   t   forcet   silentR   t   rvt   request_charsetR
   t   e(    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyR    n   s$    	c         C   s   t  ƒ  ‚ d S(   sÓ  Called if decoding of the JSON data failed.  The return value of
        this method is used by :meth:`get_json` when an error occurred.  The
        default implementation just raises a :class:`BadRequest` exception.

        .. versionchanged:: 0.10
           Removed buggy previous behavior of generating a random JSON
           response.  If you want that behavior back you can trivially
           add it by subclassing.

        .. versionadded:: 0.8
        N(   R   (   R   R/   (    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyR*   –   s    c         C   sX   t  j |  ƒ t j } | d  k	 rT | j j rT |  j d k rT |  j rT t	 |  ƒ n  d  S(   Ns   multipart/form-data(
   t   RequestBaset   _load_form_dataR   R   R	   R   t   debugR%   t   filesR   (   R   R   (    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyR1   ¤   s
    	N(   t   __name__t
   __module__t   __doc__R	   R   t	   view_argst   routing_exceptiont   FalseR   t   propertyR   R   R   R   R   t   TrueR    R*   R1   (    (    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyR       s   

(	R   c           B   s   e  Z d  Z d Z RS(   s·  The response object that is used by default in Flask.  Works like the
    response object from Werkzeug but is set to have an HTML mimetype by
    default.  Quite often you don't have to create this object yourself because
    :meth:`~flask.Flask.make_response` will take care of that for you.

    If you want to replace the response object used you can subclass this and
    set :attr:`~flask.Flask.response_class` to your subclass.
    s	   text/html(   R4   R5   R6   t   default_mimetype(    (    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyR   ¯   s   N(   R6   t   werkzeug.wrappersR    R0   R   t   ResponseBaset   werkzeug.exceptionsR   t   debughelpersR   t    R   t   globalsR   t   objectR$   R   (    (    (    sT   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/flask/wrappers.pyt   <module>
   s   		‘