Module Expr Str Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body ImportFrom alias identifier ImportFrom alias alias alias ImportFrom alias alias alias alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args defaults body If Call NameLoad NameLoad Str body Return Call AttributeLoad NameLoad attr Num Return Call NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Return Call AttributeLoad Call NameLoad BinOpMod Str TupleLoad NameLoad Call NameLoad Call NameLoad attr decorator_list ClassDef bases NameLoad body Assign NameStore TupleLoad Str FunctionDef arguments args NameParam defaults vararg kwarg body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr For NameStore AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore BinOpAdd AttributeLoad NameLoad attr TupleLoad Str Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr NameLoad BoolOpOr BoolOpAnd AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return CompareIsNot Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr Dict Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr Dict NameLoad NameLoad decorator_list decorator_list Assign NameStore Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad Str NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr BoolOpOr Call AttributeLoad NameLoad attr Str Assert UnaryOpNot Call AttributeLoad NameLoad attr NameLoad BinOpMod Str NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr BoolOpOr Call AttributeLoad NameLoad attr Str Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr BinOpMod AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str TryFinally body Expr Call NameLoad Call NameLoad NameLoad NameLoad NameLoad finalbody Expr Call AttributeLoad NameLoad attr TryExcept body Expr Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr handlers ExceptHandler type TupleLoad NameLoad NameLoad body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Return Call AttributeLoad NameLoad attr TryExcept body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Str handlers ExceptHandler type NameLoad body If AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr Assign NameStore Dict orelse TryFinally body TryExcept body Assign NameStore Call NameLoad NameLoad handlers ExceptHandler type NameLoad body Assign NameStore Dict finalbody Expr Call AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Num Assign NameStore Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr NameLoad body Continue Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Str NameLoad NameLoad Str NameLoad NameLoad NameLoad Str body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Str Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign SubscriptStore NameLoad Index AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad Str Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return Call NameLoad NameLoad NameLoad NameLoad decorator_list Return Call NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Lambda arguments args defaults Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list decorator_list
N/A N/A 
    werkzeug.contrib.sessions
    ~~~~~~~~~~~~~~~~~~~~~~~~~

    This module contains some helper classes that help one to add session
    support to a python WSGI application.  For full client-side session
    storage see :mod:`~werkzeug.contrib.securecookie` which implements a
    secure, client-side session storage.


    Application Integration
    =======================

    ::

        from werkzeug.contrib.sessions import SessionMiddleware, \
             FilesystemSessionStore

        app = SessionMiddleware(app, FilesystemSessionStore())

    The current session will then appear in the WSGI environment as
    `werkzeug.session`.  However it's recommended to not use the middleware
    but the stores directly in the application.  However for very simple
    scripts a middleware for sessions could be sufficient.

    This module does not implement methods or ways to check if a session is
    expired.  That should be done by a cronjob and storage specific.  For
    example to prune unused filesystem sessions one could check the modified
    time of the files.  It sessions are stored in the database the new()
    method should add an expiration timestamp for the session.

    For better flexibility it's recommended to not use the middleware but the
    store and session object directly in the application dispatching::

        session_store = FilesystemSessionStore()

        def application(environ, start_response):
            request = Request(environ)
            sid = request.cookies.get('cookie_name')
            if sid is None:
                request.session = session_store.new()
            else:
                request.session = session_store.get(sid)
            response = get_the_response_object(request)
            if request.session.should_save:
                session_store.save(request.session)
                response.set_cookie('cookie_name', request.session.sid)
            return response(environ, start_response)

    :copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.
    :license: BSD, see LICENSE for more details.
 N/A re N/A os N/A sys N/A tempfile os path time time random random N/A N/A hashlib sha1 N/A N/A N/A ImportError N/A sha new sha1 cPickle dump load HIGHEST_PROTOCOL werkzeug ClosingIterator dump_cookie parse_cookie CallbackDict werkzeug.posixemulation rename N/A _sha1_re N/A N/A re compile ^[a-f0-9]{40}$ _urandom N/A N/A N/A N/A N/A N/A hasattr os urandom N/A N/A N/A N/A os urandom 30 N/A N/A random N/A generate_key N/A N/A salt N/A None N/A N/A N/A N/A N/A sha1 N/A %s%s%s N/A salt N/A time N/A _urandom hexdigest N/A ModificationTrackingDict N/A CallbackDict N/A N/A __slots__ N/A modified __init__ N/A N/A self N/A args kwargs N/A on_update N/A N/A self N/A N/A N/A N/A self modified True N/A N/A N/A self modified False N/A N/A N/A CallbackDict __init__ self on_update on_update N/A N/A N/A dict update self args kwargs N/A copy N/A N/A self N/A N/A N/A Create a flat copy of the dict. N/A missing N/A object N/A result N/A N/A object __new__ N/A self __class__ N/A name N/A self __slots__ N/A N/A val N/A getattr self name missing N/A N/A val missing N/A N/A N/A setattr result name val N/A result N/A __copy__ N/A N/A self N/A N/A N/A N/A N/A self copy N/A N/A Session N/A ModificationTrackingDict N/A N/A Subclass of a dict that keeps track of direct object changes.  Changes
    in mutable structures are not tracked, for those you have to set
    `modified` to `True` by hand.
     N/A __slots__ N/A N/A ModificationTrackingDict __slots__ N/A sid new __init__ N/A N/A self data sid new N/A False N/A N/A N/A N/A ModificationTrackingDict __init__ self data N/A N/A self sid sid N/A N/A self new new N/A __repr__ N/A N/A self N/A N/A N/A N/A <%s %s%s> N/A N/A N/A self __class__ __name__ N/A N/A dict __repr__ self N/A N/A N/A self should_save * N/A should_save N/A N/A self N/A N/A N/A True if the session should be saved.

        .. versionchanged:: 0.6
           By default the session is now only saved if the session is
           modified, not if it is new like it was before.
         N/A N/A self modified N/A property N/A SessionStore N/A object N/A N/A Baseclass for all session stores.  The Werkzeug contrib module does not
    implement any useful stores besides the filesystem store, application
    developers are encouraged to create their own stores.

    :param session_class: The session class to use.  Defaults to
                          :class:`Session`.
     __init__ N/A N/A self session_class N/A None N/A N/A N/A session_class None N/A N/A session_class Session N/A N/A self session_class session_class N/A is_valid_key N/A N/A self key N/A N/A N/A Check if a key has the correct format. N/A N/A N/A N/A _sha1_re match key None N/A generate_key N/A N/A self salt N/A None N/A N/A Simple function that generates a new session key. N/A N/A generate_key salt N/A new N/A N/A self N/A N/A N/A Generate a new session. N/A N/A N/A self session_class N/A N/A N/A self generate_key True N/A save N/A N/A self session N/A N/A N/A Save a session. N/A save_if_modified N/A N/A self session N/A N/A N/A Save if a session class wants an update. N/A N/A session should_save N/A N/A N/A N/A self save session N/A delete N/A N/A self session N/A N/A N/A Delete a session. N/A get N/A N/A self sid N/A N/A N/A Get a session for this sid or a new session object.  This method
        has to check if the session key is valid and create a new session if
        that wasn't the case.
         N/A N/A N/A self session_class N/A sid True N/A N/A N/A _fs_transaction_suffix .__wz_sess FilesystemSessionStore N/A SessionStore N/A N/A Simple example session store that saves sessions on the filesystem.
    This store works best on POSIX systems and Windows Vista / Windows
    Server 2008 and newer.

    .. versionchanged:: 0.6
       `renew_missing` was added.  Previously this was considered `True`,
       now the default changed to `False` and it can be explicitly
       deactivated.

    :param path: the path to the folder used for storing the sessions.
                 If not provided the default temporary directory is used.
    :param filename_template: a string template used to give the session
                              a filename.  ``%s`` is replaced with the
                              session id.
    :param session_class: The session class to use.  Defaults to
                          :class:`Session`.
    :param renew_missing: set to `True` if you want the store to
                          give the user a new sid if the session was
                          not yet saved.
     __init__ N/A N/A self path filename_template session_class renew_missing mode N/A None werkzeug_%s.sess None False 420 N/A N/A N/A N/A SessionStore __init__ self session_class N/A N/A path None N/A N/A path N/A N/A tempfile gettempdir N/A N/A self path path N/A N/A isinstance filename_template unicode N/A N/A filename_template N/A N/A filename_template encode N/A N/A N/A sys getfilesystemencoding utf-8 N/A N/A N/A N/A filename_template endswith _fs_transaction_suffix N/A filename templates may not end with %s _fs_transaction_suffix N/A N/A self filename_template filename_template N/A N/A self renew_missing renew_missing N/A N/A self mode mode N/A get_session_filename N/A N/A self sid N/A N/A N/A N/A isinstance sid unicode N/A N/A sid N/A N/A sid encode N/A N/A N/A sys getfilesystemencoding utf-8 N/A N/A N/A path join N/A self path N/A N/A self filename_template sid N/A save N/A N/A self session N/A N/A N/A fn N/A N/A self get_session_filename N/A session sid N/A N/A fd tmp N/A N/A tempfile mkstemp suffix _fs_transaction_suffix dir N/A self path N/A f N/A N/A os fdopen fd wb N/A N/A N/A N/A dump N/A dict session f HIGHEST_PROTOCOL N/A N/A N/A N/A f close N/A N/A N/A N/A rename tmp fn N/A N/A N/A os chmod fn N/A self mode N/A N/A N/A N/A IOError OSError N/A N/A N/A delete N/A N/A self session N/A N/A N/A fn N/A N/A self get_session_filename N/A session sid N/A N/A N/A N/A N/A os unlink fn N/A N/A N/A OSError N/A N/A N/A get N/A N/A self sid N/A N/A N/A N/A N/A N/A self is_valid_key sid N/A N/A N/A N/A self new N/A N/A N/A f N/A open N/A N/A self get_session_filename sid rb N/A N/A N/A IOError N/A N/A N/A self renew_missing N/A N/A N/A N/A self new N/A data N/A N/A N/A N/A N/A N/A N/A data N/A load f N/A N/A N/A Exception N/A N/A data N/A N/A N/A N/A N/A f close N/A N/A N/A self session_class data sid False N/A list N/A N/A self N/A N/A N/A Lists all sessions in the store.

        .. versionadded:: 0.6
         N/A N/A before after N/A N/A N/A self filename_template split %s 1 N/A filename_re N/A N/A re compile N/A %s(.{5,})%s$ N/A N/A N/A re escape before N/A N/A re escape after N/A result N/A N/A filename N/A N/A os listdir N/A self path N/A N/A N/A N/A filename endswith _fs_transaction_suffix N/A N/A N/A match N/A N/A filename_re match filename N/A N/A match None N/A N/A N/A N/A result append N/A N/A match group 1 N/A result N/A N/A SessionMiddleware N/A object N/A N/A A simple middleware that puts the session object of a store provided
    into the WSGI environ.  It automatically sets cookies and restores
    sessions.

    However a middleware is not the preferred solution because it won't be as
    fast as sessions managed by the application itself and will put a key into
    the WSGI environment only relevant for the application which is against
    the concept of WSGI.

    The cookie parameters are the same as for the :func:`~werkzeug.dump_cookie`
    function just prefixed with ``cookie_``.  Additionally `max_age` is
    called `cookie_age` and not `cookie_max_age` because of backwards
    compatibility.
     __init__ N/A N/A self app store cookie_name cookie_age cookie_expires cookie_path cookie_domain cookie_secure cookie_httponly environ_key N/A session_id None None / None None False werkzeug.session N/A N/A N/A self app app N/A N/A self store store N/A N/A self cookie_name cookie_name N/A N/A self cookie_age cookie_age N/A N/A self cookie_expires cookie_expires N/A N/A self cookie_path cookie_path N/A N/A self cookie_domain cookie_domain N/A N/A self cookie_secure cookie_secure N/A N/A self cookie_httponly cookie_httponly N/A N/A self environ_key environ_key N/A __call__ N/A N/A self environ start_response N/A N/A N/A cookie N/A parse_cookie N/A N/A environ get HTTP_COOKIE N/A sid N/A N/A cookie get N/A self cookie_name None N/A N/A sid None N/A N/A session N/A N/A N/A self store new N/A N/A session N/A N/A N/A self store get sid N/A N/A environ N/A N/A self environ_key session injecting_start_response N/A N/A status headers exc_info N/A None N/A N/A N/A session should_save N/A N/A N/A N/A N/A self store save session N/A N/A N/A headers append N/A Set-Cookie N/A dump_cookie N/A self cookie_name N/A session sid N/A self cookie_age N/A self cookie_expires N/A self cookie_path N/A self cookie_domain N/A self cookie_secure N/A self cookie_httponly N/A N/A start_response status headers exc_info N/A N/A N/A ClosingIterator N/A N/A self app environ injecting_start_response N/A N/A N/A N/A N/A N/A N/A self store save_if_modified session N/A N/A