Ñò
ÞŸIc @ s€ d Z d d k Z d d k Z d d k Z d d k Z y d d k Z Wn e j
o d d k Z n Xy d d k l Z Wn e j
o d d k
Z n Xd d k l Z d d k
l Z d d k
l Z d d k l Z d d k Z d d d
d d d
g Z e i e ƒ Z d e f d „ ƒ YZ d
e f d „ ƒ YZ d d „ Z d „ Z d d d d d „ Z d d „ Z d „ Z d S( s Utility functions and classes available for use by Controllers
Pylons subclasses the `WebOb `_
:class:`webob.Request` and :class:`webob.Response` classes to provide
backwards compatible functions for earlier versions of Pylons as well
as add a few helper functions to assist with signed cookies.
For reference use, refer to the :class:`Request` and :class:`Response`
below.
Functions available:
:func:`abort`, :func:`forward`, :func:`etag_cache`,
:func:`mimetype`, :func:`redirect`, and :func:`redirect_to`
iÿÿÿÿN( t sha1( t url_for( t Request( t Response( t
status_mapt abortt
etag_cachet redirectt redirect_toR R c B s> e Z d Z d „ Z d „ Z e e ƒ Z d „ Z d „ Z RS( sï WebOb Request subclass
The WebOb :class:`webob.Request` has no charset, or other defaults. This subclass
adds defaults, along with several methods for backwards
compatibility with paste.wsgiwrappers.WSGIRequest.
c C s | i S( sH Legacy method to return the
:attr:`webob.Request.accept_charset`( t accept_charset( t self( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyt determine_browser_charset1 s c C s | i i | i ƒ S( N( t accept_languaget best_matchest language( R
( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyt languages6 s c C s | i i | ƒ S( N( t acceptt first_match( R
t mimetypes( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyt match_accept: s c C sŽ | i i | ƒ } | p d Sy" | d t i | d ƒ } } Wn t i j
o d SXt i | | t ƒ i ƒ | j o t
i | ƒ Sd S( s\ Extract a signed cookie of ``name`` from the request
The cookie is expected to have been created with
``Response.signed_cookie``, and the ``secret`` should be the
same as the one used to sign it.
Any failure in the signature of the data will result in None
being returned.
Ni( ( t str_cookiest gett base64t decodestringt binasciit Errort hmact newR t hexdigestt picklet loads( R
t namet secrett cookiet sigt pickled( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyt
signed_cookie= s ""( t __name__t
__module__t __doc__R R t propertyR R$ ( ( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyR ) s c B sP e Z d Z e i Z d „ Z d „ Z d „ Z d „ Z d „ Z
d d „ Z RS( sð WebOb Response subclass
The WebOb Response has no default content type, or error defaults.
This subclass adds defaults, along with several methods for
backwards compatibility with paste.wsgiwrappers.WSGIResponse.
c C s | i S( N( t charset( R
( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyt determine_charset^ s c C s
| | i j S( N( t headers( R
t header( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyt
has_headera s c C s | i S( N( t body( R
( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyt get_contentd s c C s | i i | ƒ d S( N( t body_filet write( R
t content( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyR1 g s c C s | i | i | i f S( N( t statusR+ R. ( R
( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyt
wsgi_responsej s c K sT t i | t i ƒ } t i | | t ƒ i ƒ } | i | | t i | ƒ | d S( s/ Save a signed cookie with ``secret`` signature
Saves a signed cookie of the pickled data. All other keyword
arguments that ``WebOb.set_cookie`` accepts are usable and
passed to the WebOb set_cookie method after creating the signed
cookie value.
N(
R t dumpst HIGHEST_PROTOCOLR R R R t
set_cookieR t encodestring( R
R t dataR t kwargsR# R" ( ( s; /usr/lib/python2.6/site-packages/pylons/controllers/util.pyR$ m s N(
R% R&