Package gluon :: Module globals :: Class Session
[hide private]
[frames] | no frames]

Class Session

source code

 object --+        
          |        
       dict --+    
              |    
storage.Storage --+
                  |
                 Session


Defines the session object and the default values of its members (None)

- session_storage_type   : 'file', 'db', or 'cookie'
- session_cookie_compression_level :
- session_cookie_expires : cookie expiration
- session_cookie_key     : for encrypted sessions in cookies
- session_id             : a number or None if no session
- session_id_name        :
- session_locked         :
- session_masterapp      :
- session_new            : a new session obj is being created
- session_hash           : hash of the pickled loaded session
- session_pickled        : picked session

if session in cookie:

- session_data_name      : name of the cookie for session data

if session in db:

- session_db_record_id
- session_db_table
- session_db_unique_key

if session in file:

- session_file
- session_filename

Instance Methods [hide private]
 
connect(self, request=None, response=None, db=None, tablename='web2py_session', masterapp=None, migrate=True, separate=None, check_client=False, cookie_key=None, cookie_expires=None, compression_level=None)
Used in models, allows to customize Session handling
source code
 
renew(self, clear_session=False) source code
 
_fixup_before_save(self) source code
 
clear_session_cookies(sefl) source code
 
save_session_id_cookie(self) source code
None
clear(self)
Remove all items from D.
source code
 
is_new(self) source code
 
is_expired(self, seconds=3600) source code
 
secure(self) source code
 
forget(self, response=None) source code
 
_try_store_in_cookie(self, request, response) source code
 
_unchanged(self, response) source code
 
_try_store_in_db(self, request, response) source code
 
_try_store_in_cookie_or_file(self, request, response) source code
 
_try_store_in_file(self, request, response) source code
 
_unlock(self, response) source code
 
_close(self, response) source code

Inherited from storage.Storage: __copy__, __delattr__, __getattr__, __getitem__, __getstate__, __repr__, __setattr__, getfirst, getlast, getlist

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __gt__, __init__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __setitem__, __sizeof__, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values, viewitems, viewkeys, viewvalues

Inherited from object: __format__, __reduce__, __reduce_ex__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

connect(self, request=None, response=None, db=None, tablename='web2py_session', masterapp=None, migrate=True, separate=None, check_client=False, cookie_key=None, cookie_expires=None, compression_level=None)

source code 

Used in models, allows to customize Session handling

Args:
    request: the request object
    response: the response object
    db: to store/retrieve sessions in db (a table is created)
    tablename(str): table name
    masterapp(str): points to another's app sessions. This enables a
        "SSO" environment among apps
    migrate: passed to the underlying db
    separate: with True, creates a folder with the 2 initials of the
        session id. Can also be a function, e.g. ::

            separate=lambda(session_name): session_name[-2:]

    check_client: if True, sessions can only come from the same ip
    cookie_key(str): secret for cookie encryption
    cookie_expires: sets the expiration of the cookie
    compression_level(int): 0-9, sets zlib compression on the data
        before the encryption

clear(self)

source code 

Remove all items from D.

Returns: None
Overrides: dict.clear
(inherited documentation)