[Zope-Checkins] CVS: Zope/lib/python/Products/Sessions - BrowserIdManager.py:1.12 SessionInterfaces.py:1.10
Chris McDonough
chrism@zope.com
Sat, 10 Aug 2002 15:29:08 -0400
Update of /cvs-repository/Zope/lib/python/Products/Sessions
In directory cvs.zope.org:/tmp/cvs-serv7971
Modified Files:
BrowserIdManager.py SessionInterfaces.py
Log Message:
Add getHiddenFormField method to browser id manager.
This method is a convenience function which allows you to obtain a snippet
of html containing a hidden input form element which contains the
browser id name and browser id value.
=== Zope/lib/python/Products/Sessions/BrowserIdManager.py 1.11 => 1.12 ===
--- Zope/lib/python/Products/Sessions/BrowserIdManager.py:1.11 Thu Aug 1 12:00:40 2002
+++ Zope/lib/python/Products/Sessions/BrowserIdManager.py Sat Aug 10 15:28:37 2002
@@ -379,6 +379,15 @@
"""
return ('form', 'cookies')
+ security.declareProtected(ACCESS_CONTENTS_PERM, 'getHiddenFormField')
+ def getHiddenFormField(self):
+ """
+ Convenience method which returns a hidden form element
+ representing the current browser id name and browser id
+ """
+ s = '<input type="hidden" name="%s" value="%s">'
+ return s % (self.getBrowserIdName(), self.getBrowserId())
+
# non-interface methods follow
def _getNewBrowserId(self, randint=random.randint, maxint=99999999):
=== Zope/lib/python/Products/Sessions/SessionInterfaces.py 1.9 => 1.10 ===
--- Zope/lib/python/Products/Sessions/SessionInterfaces.py:1.9 Wed Mar 13 11:39:04 2002
+++ Zope/lib/python/Products/Sessions/SessionInterfaces.py Sat Aug 10 15:28:37 2002
@@ -12,12 +12,10 @@
############################################################################
"""
-Session API
+Sessioning-related Object APIs
See Also
- - "Programming with the Session API":sessionapi-prog.stx
-
- "Transient Object API":../../Transience/Help/TransienceInterfaces.py
"""
@@ -132,6 +130,16 @@
a browser id namespace at the time of the call.
"""
+ def getHiddenFormField():
+ """
+ Returns a string in the form:
+
+ <input type="hidden" name="_ZopeId" value="H7HJGYUFGFyHKH*">
+
+ Where the name and the value represent the current browser id
+ name and current browser id.
+ """
+
class SessionDataManagerInterface(
Interface.Base
):
@@ -179,3 +187,24 @@
Permission required: Access arbitrary user session data
"""
+class SessionDataManagerErr(Interface.Base):
+ """
+ Error raised during some session data manager operations, as
+ explained in the API documentation of the Session Data Manager.
+
+ This exception may be caught in PythonScripts. A successful
+ import of the exception for PythonScript use would need to be::
+
+ from Products.Sessions import SessionDataManagerErr
+ """
+
+class BrowserIdManagerErr(Interface.Base):
+ """
+ Error raised during some browser id manager operations, as
+ explained in the API documentation of the Browser Id Manager.
+
+ This exception may be caught in PythonScripts. A successful
+ import of the exception for PythonScript use would need to be::
+
+ from Products.Sessions import BrowserIdManagerErr
+ """