File manager - Edit - /opt/imh-python/lib/python2.7/site-packages/werkzeug/contrib/wrappers.pyc
Back
� �[�Rc @ s! d Z d d l Z y d d l m Z Wn! e k rI d d l m Z n Xd d l m Z d d l m Z d d l m Z m Z d d l m Z d � Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d S( s� werkzeug.contrib.wrappers ~~~~~~~~~~~~~~~~~~~~~~~~~ Extra wrappers or mixins contributed by the community. These wrappers can be mixed in into request objects to add extra functionality. Example:: from werkzeug.wrappers import Request as RequestBase from werkzeug.contrib.wrappers import JSONRequestMixin class Request(RequestBase, JSONRequestMixin): pass Afterwards this request object provides the extra functionality of the :class:`JSONRequestMixin`. :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. i����N( t loads( t BadRequest( t cached_property( t dump_options_headert parse_options_header( t wsgi_decoding_dancec C s* y t j | � Wn t k r% t SXt S( s/ Checks if the given charset is known to Python.( t codecst lookupt LookupErrort Falset True( t charset( ( sH /opt/imh-python/lib/python2.7/site-packages/werkzeug/contrib/wrappers.pyt is_known_charset# s t JSONRequestMixinc B s e Z d Z e d � � Z RS( s� Add json method to a request object. This will parse the input data through simplejson if possible. :exc:`~werkzeug.exceptions.BadRequest` will be raised if the content-type is not json or if the data itself cannot be parsed as json. c C s_ d | j j d d � k r* t d � � n y t | j � SWn t k rZ t d � � n Xd S( s/ Get the result of simplejson.loads if possible.t jsont CONTENT_TYPEt s Not a JSON requests Unable to read JSON requestN( t environt getR R t datat Exception( t self( ( sH /opt/imh-python/lib/python2.7/site-packages/werkzeug/contrib/wrappers.pyR 4 s ( t __name__t __module__t __doc__R R ( ( ( sH /opt/imh-python/lib/python2.7/site-packages/werkzeug/contrib/wrappers.pyR , s t ProtobufRequestMixinc B s e Z d Z e Z d � Z RS( sD Add protobuf parsing method to a request object. This will parse the input data through `protobuf`_ if possible. :exc:`~werkzeug.exceptions.BadRequest` will be raised if the content-type is not protobuf or if the data itself cannot be parsed property. .. _protobuf: http://code.google.com/p/protobuf/ c C s� d | j j d d � k r* t d � � n | � } y | j | j � Wn t k rf t d � � n X| j r� | j � r� t d � � n | S( s. Parse the data into an instance of proto_type.t protobufR R s Not a Protobuf requests Unable to parse Protobuf requests Partial Protobuf request( R R R t ParseFromStringR R t protobuf_check_initializationt IsInitialized( R t proto_typet obj( ( sH /opt/imh-python/lib/python2.7/site-packages/werkzeug/contrib/wrappers.pyt parse_protobufO s ( R R R R R R ( ( ( sH /opt/imh-python/lib/python2.7/site-packages/werkzeug/contrib/wrappers.pyR ? s t RoutingArgsRequestMixinc B sh e Z d Z d � Z d � Z e e e d d �Z [ [ d � Z d � Z e e e d d �Z [ [ RS( s� This request mixin adds support for the wsgiorg routing args `specification`_. .. _specification: http://www.wsgi.org/wsgi/Specifications/routing_args c C s | j j d d � d S( Ns wsgiorg.routing_argsi ( ( R R ( R ( ( sH /opt/imh-python/lib/python2.7/site-packages/werkzeug/contrib/wrappers.pyt _get_routing_argsh s c C s2 | j r t d � � n | | j f | j d <d S( Nso A shallow request tried to modify the WSGI environment. If you really want to do that, set `shallow` to False.s wsgiorg.routing_args( t shallowt RuntimeErrort routing_varsR ( R t value( ( sH /opt/imh-python/lib/python2.7/site-packages/werkzeug/contrib/wrappers.pyt _set_routing_argsk s t docs1 The positional URL arguments as `tuple`.c C sE | j j d � } | d k r&