You are not logged in Log in Join
You are here: Home » Members » hungjunglu » Products » HappySession » dc_view

Log in
Name

Password

 
 


Dublin Core Elements

The Dublin Core metadata element set is a standard for cross-domain information resource description.
Element Description Value
Identifier resource ID http://old.zope.org/Members/hungjunglu/Products/HappySession
Title resource name
Description resource summary <p> HappySession is an easy-to-use session management product. It uses a cookie to store the session id (128-alphanumeric key) and the actual session data is stored in RAM. You specify a maximum session idle time, and expired session data are automatically deleted. HappySession <img src="happysession.gif" align=absmiddle> is Zope-transaction-aware. </p> <p> You can provide a comment/feedback through e-mail to me by using <A HREF="/Members/hungjunglu/feedback_form?came_from=http://www.zope.org/Members/hungjunglu/Products/HappySession"><b>Feedback to this page's author</b></a> </p> <h3>Changes</h3> <p> Version 0.1.1 fixes a problem on Linux platform where the session cookie is not erased properly when a session expires. </p> <h3>Installation</h3> <p> Download HappySession.tgz and untar it in your root Zope directory. Restart Zope. </p> <h3>Usage</h3> <p> Create a HappySession instance. It will be named SESSION. </p> <p> The HappySession object behaves like a Python dictionary with extra bonus. If an item does not exist, it will safely return a _.None value. Similarly, if an item is set to _.None, it will automatically be deleted. You can store any kind of Python object inside HappySession, not just strings or numbers. </p> <h3>Examples</h3> <p> To set a session variable: </p> <blockquote><pre> &#60;dtml-call "SESSION.set('my_key','my_value')"> </pre></blockquote> <p> To view a session variable: </p> <blockquote><pre> &#60;dtml-var "SESSION['my_key']"> </pre></blockquote> <p> To view the session contents: </p> <blockquote><pre> &#60;dtml-var "_.str(SESSION)"> </pre></blockquote> <p> To iterate over all session keys: </p> <blockquote><pre> &#60;dtml-in "SESSION.keys()"> ... &#60;/dtml-in> </pre></blockquote> <p> To clear session data: </p> <blockquote><pre> &#60;dtml-call "SESSION.clear()"> </pre></blockquote> <h3>Handling Session-Not-Found Exception</h3> <p> You can catch the Session-Not-Found exception by modifying your standard_error_message (usually located at the root of the Zope hierarchy tree) to something like: </p> <blockquote><pre> &#60;!--#var standard_html_header--> &#60;!--#if error_message--> &#60;!--#var error_message--> &#60;!--#else--> &#60;dtml-if "error_type == 'SessionNotFoundError'"> &#60;dtml-return session_not_found_html> &#60;/dtml-if> ..... </pre></blockquote> <p> and then design and display your own session_not_found_html page. </p> <p> After the Session-Not-Found exception is raised, the session cookie is set to an empty string, and the next time any SESSION method is called, a new session will start automatically. </p>
Creator resource creator ZopeOrgSite
Date default date 2000-09-12 16:15:39
Format resource format text/html
Type resource type Software Package
Subject resource keywords External Access
Contributors resource collaborators
Language resource language
Publisher resource publisher No publisher
Rights resource copyright


Additional Zope Elements

Element Description Value
CreationDate date resource created 2000-09-12 16:15:39
ModificationDate date resource last modified 2000-09-12 16:15:39
EffectiveDate date resource becomes effective None
ExpirationDate date resource expires None

Backlinks: via Google / Technorati