summaryrefslogtreecommitdiff
path: root/wsgitools
diff options
context:
space:
mode:
Diffstat (limited to 'wsgitools')
-rwxr-xr-xwsgitools/digest.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/wsgitools/digest.py b/wsgitools/digest.py
index d0039e0..c3485e7 100755
--- a/wsgitools/digest.py
+++ b/wsgitools/digest.py
@@ -333,6 +333,18 @@ class DBAPI2NonceStore(NonceStoreBase):
"""
A dbapi2-backed nonce store implementation suitable for usage with forking
wsgi servers such as scgi.forkpool.
+ >>> import sqlite3
+ >>> db = sqlite3.connect(":memory:")
+ >>> db.cursor().execute("CREATE TABLE nonces (key, value);") and None
+ >>> db.commit() and None
+ >>> s = DBAPI2NonceStore(db, maxuses=1)
+ >>> n = s.newnonce()
+ >>> s.checknonce("spam")
+ False
+ >>> s.checknonce(n)
+ True
+ >>> s.checknonce(n)
+ False
"""
def __init__(self, dbhandle, maxage=300, maxuses=5, table="nonces"):
"""