The Session object provides access to the builtin automated session
management. Its global instance stored under the name session
in the
current module.
Session management is not always available. If a web robot is detected by
Draco, no session is generated. This has the advantages that search engines
will not index URLs that contain session ids and that no spurious sessions
are being generated. So before using session management, you should check
that it is available by checking the global session
instance for
non-zeroness.
The Session object also provides access to the session namespace using the namespace API. This means that you can get, set and remove session variables using Python's dictionary syntax on the Session object. A small example:
from draco.session import session session['spam'] = 'spamspam del session['spam']
) |
scope) |
'__system__'
.
) |
None
is
returned.
userid) |
) |
) |
0
if
it is not.
) |
A persistent session is a session that is kept between browser sessions and has a greater expiration time5.2. Persistent sessions can be used to implement a ``remember me'' function. Only logged in session can be made persistent.
[persistent=1]) |