diff options
author | Helmut Grohne <helmut@subdivi.de> | 2009-06-24 18:10:52 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2009-06-24 18:10:52 +0200 |
commit | 92a35e0e81725d6fa26df8a7cb88d22cb24575c3 (patch) | |
tree | db50cfeff934ff42b858b87114ac85ad5abb9fe8 /wsgitools/digest.py | |
parent | bdd4de6cfd3e5c8f4b5a246a47a6e42f737467c4 (diff) | |
download | wsgitools-92a35e0e81725d6fa26df8a7cb88d22cb24575c3.tar.gz |
added doctest for DBAPI2NonceStore
Diffstat (limited to 'wsgitools/digest.py')
-rwxr-xr-x | wsgitools/digest.py | 12 |
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"): """ |