Mercurial > p > roundup > code
annotate roundup/backends/sessions_rdbms.py @ 6438:b671ed2b49b2
2551143: Problem with installing external trackers ...
the change from distutils to setuptools moved the directories for the
templates, man pages and docs under the install directory. The install
directory is buried in the directory tree under
/usr/ib/python/.../roundup...egg/...
This patch tries to put them under:
the directory specified by --prefix argument
the python platform library prefix that prefixes /lib
in sysconfig.getpath('platlib')
the directory returned by sys.prefix.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 19 Jun 2021 14:22:36 -0400 |
| parents | 883c9e90b403 |
| children | db437dd13ed5 |
| rev | line source |
|---|---|
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1 """This module defines a very basic store that's used by the CGI interface |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 to store session and one-time-key information. |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3 |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4 Yes, it's called "sessions" - because originally it only defined a session |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
5 class. It's now also used for One Time Key handling too. |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
6 """ |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 __docformat__ = 'restructuredtext' |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
8 import os, time, logging |
|
5806
abee2c2c822e
More cgi.escape/html.escape fixes.
John Rouillard <rouilj@ieee.org>
parents:
5319
diff
changeset
|
9 |
|
5837
883c9e90b403
Fix problem with cgi.escape being depricated a different way. This way
John Rouillard <rouilj@ieee.org>
parents:
5806
diff
changeset
|
10 from roundup.anypy.html import html_escape as escape |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
11 |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 class BasicDatabase: |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
13 ''' Provide a nice encapsulation of an RDBMS table. |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 Keys are id strings, values are automatically marshalled data. |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 ''' |
|
5252
0b154486ed38
Make sure that the name property is initialized to none.
John Rouillard <rouilj@ieee.org>
parents:
5213
diff
changeset
|
17 name = None |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
18 def __init__(self, db): |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
19 self.db = db |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
20 self.conn, self.cursor = self.db.sql_open_connection() |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 def clear(self): |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
23 self.cursor.execute('delete from %ss'%self.name) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 |
|
2169
12cd4fa91eb7
OTK generation was busted (thanks Stuart D. Gathman)
Richard Jones <richard@users.sourceforge.net>
parents:
2082
diff
changeset
|
25 def exists(self, infoid): |
|
12cd4fa91eb7
OTK generation was busted (thanks Stuart D. Gathman)
Richard Jones <richard@users.sourceforge.net>
parents:
2082
diff
changeset
|
26 n = self.name |
|
12cd4fa91eb7
OTK generation was busted (thanks Stuart D. Gathman)
Richard Jones <richard@users.sourceforge.net>
parents:
2082
diff
changeset
|
27 self.cursor.execute('select count(*) from %ss where %s_key=%s'%(n, |
|
12cd4fa91eb7
OTK generation was busted (thanks Stuart D. Gathman)
Richard Jones <richard@users.sourceforge.net>
parents:
2082
diff
changeset
|
28 n, self.db.arg), (infoid,)) |
|
2244
ac4f295499a4
fixed journal marshalling in RDBMS backends [SF#943627]
Richard Jones <richard@users.sourceforge.net>
parents:
2169
diff
changeset
|
29 return int(self.cursor.fetchone()[0]) |
|
2169
12cd4fa91eb7
OTK generation was busted (thanks Stuart D. Gathman)
Richard Jones <richard@users.sourceforge.net>
parents:
2082
diff
changeset
|
30 |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
31 _marker = [] |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
32 def get(self, infoid, value, default=_marker): |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 n = self.name |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
34 self.cursor.execute('select %s_value from %ss where %s_key=%s'%(n, |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 n, n, self.db.arg), (infoid,)) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
36 res = self.cursor.fetchone() |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
37 if not res: |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
38 if default != self._marker: |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 return default |
|
4585
033a550812fc
Fix another XSS with the "otk" parameter.
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
40 raise KeyError('No such %s "%s"'%(self.name, escape(infoid))) |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
41 values = eval(res[0]) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
42 return values.get(value, None) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
43 |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
44 def getall(self, infoid): |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
45 n = self.name |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
46 self.cursor.execute('select %s_value from %ss where %s_key=%s'%(n, |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
47 n, n, self.db.arg), (infoid,)) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
48 res = self.cursor.fetchone() |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
49 if not res: |
|
4585
033a550812fc
Fix another XSS with the "otk" parameter.
Ralf Schlatterbeck <rsc@runtux.com>
parents:
4570
diff
changeset
|
50 raise KeyError('No such %s "%s"'%(self.name, escape (infoid))) |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
51 return eval(res[0]) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
52 |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
53 def set(self, infoid, **newvalues): |
|
5213
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
54 """ Store all newvalues under key infoid with a timestamp in database. |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
55 |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
56 If newvalues['__timestamp'] exists and is representable as a floating point number |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
57 (i.e. could be generated by time.time()), that value is used for the <name>_time |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
58 column in the database. |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
59 """ |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
60 c = self.cursor |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
61 n = self.name |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
62 a = self.db.arg |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
63 c.execute('select %s_value from %ss where %s_key=%s'%(n, n, n, a), |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
64 (infoid,)) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
65 res = c.fetchone() |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
66 if res: |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
67 values = eval(res[0]) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
68 else: |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
69 values = {} |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
70 values.update(newvalues) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
71 |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
72 if res: |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
73 sql = 'update %ss set %s_value=%s where %s_key=%s'%(n, n, |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
74 a, n, a) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
75 args = (repr(values), infoid) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
76 else: |
|
5213
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
77 if '__timestamp' in newvalues: |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
78 try: |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
79 # __timestamp must be represntable as a float. Check it. |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
80 timestamp = float(newvalues['__timestamp']) |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
81 except ValueError: |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
82 timestamp = time.time() |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
83 else: |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
84 timestamp = time.time() |
|
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
85 |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
86 sql = 'insert into %ss (%s_key, %s_time, %s_value) '\ |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
87 'values (%s, %s, %s)'%(n, n, n, n, a, a, a) |
|
5213
bf13b28156f3
This change didn't make it into the last commit. Allow the user to
John Rouillard <rouilj@ieee.org>
parents:
4585
diff
changeset
|
88 args = (infoid, timestamp, repr(values)) |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
89 c.execute(sql, args) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
90 |
|
4390
936bd9bf732d
session API consistency
Richard Jones <richard@users.sourceforge.net>
parents:
4362
diff
changeset
|
91 def list(self): |
|
936bd9bf732d
session API consistency
Richard Jones <richard@users.sourceforge.net>
parents:
4362
diff
changeset
|
92 c = self.cursor |
|
936bd9bf732d
session API consistency
Richard Jones <richard@users.sourceforge.net>
parents:
4362
diff
changeset
|
93 n = self.name |
|
936bd9bf732d
session API consistency
Richard Jones <richard@users.sourceforge.net>
parents:
4362
diff
changeset
|
94 c.execute('select %s_key from %ss'%(n, n)) |
|
936bd9bf732d
session API consistency
Richard Jones <richard@users.sourceforge.net>
parents:
4362
diff
changeset
|
95 return [res[0] for res in c.fetchall()] |
|
936bd9bf732d
session API consistency
Richard Jones <richard@users.sourceforge.net>
parents:
4362
diff
changeset
|
96 |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
97 def destroy(self, infoid): |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
98 self.cursor.execute('delete from %ss where %s_key=%s'%(self.name, |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
99 self.name, self.db.arg), (infoid,)) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
100 |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
101 def updateTimestamp(self, infoid): |
|
3848
7ad206564007
Use """ instead of ''' in comments, or emacs python-mode bails out.
Erik Forsberg <forsberg@users.sourceforge.net>
parents:
3606
diff
changeset
|
102 """ don't update every hit - once a minute should be OK """ |
|
3606
04dc3eef67b7
reduced frequency of session timestamp update
Richard Jones <richard@users.sourceforge.net>
parents:
2244
diff
changeset
|
103 now = time.time() |
|
04dc3eef67b7
reduced frequency of session timestamp update
Richard Jones <richard@users.sourceforge.net>
parents:
2244
diff
changeset
|
104 self.cursor.execute('''update %ss set %s_time=%s where %s_key=%s |
|
04dc3eef67b7
reduced frequency of session timestamp update
Richard Jones <richard@users.sourceforge.net>
parents:
2244
diff
changeset
|
105 and %s_time < %s'''%(self.name, self.name, self.db.arg, |
|
04dc3eef67b7
reduced frequency of session timestamp update
Richard Jones <richard@users.sourceforge.net>
parents:
2244
diff
changeset
|
106 self.name, self.db.arg, self.name, self.db.arg), |
|
04dc3eef67b7
reduced frequency of session timestamp update
Richard Jones <richard@users.sourceforge.net>
parents:
2244
diff
changeset
|
107 (now, infoid, now-60)) |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
108 |
|
3989
0112e9e1d068
improvements to session management
Richard Jones <richard@users.sourceforge.net>
parents:
3920
diff
changeset
|
109 def clean(self): |
|
0112e9e1d068
improvements to session management
Richard Jones <richard@users.sourceforge.net>
parents:
3920
diff
changeset
|
110 ''' Remove session records that haven't been used for a week. ''' |
|
0112e9e1d068
improvements to session management
Richard Jones <richard@users.sourceforge.net>
parents:
3920
diff
changeset
|
111 now = time.time() |
|
0112e9e1d068
improvements to session management
Richard Jones <richard@users.sourceforge.net>
parents:
3920
diff
changeset
|
112 week = 60*60*24*7 |
|
0112e9e1d068
improvements to session management
Richard Jones <richard@users.sourceforge.net>
parents:
3920
diff
changeset
|
113 old = now - week |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
114 self.cursor.execute('delete from %ss where %s_time < %s'%(self.name, |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
115 self.name, self.db.arg), (old, )) |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
116 |
|
5319
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
117 def commit(self): |
|
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
118 logger = logging.getLogger('roundup.hyperdb.backend') |
|
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
119 logger.info('commit %s' % self.name) |
|
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
120 self.conn.commit() |
|
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
121 self.cursor = self.conn.cursor() |
|
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
122 |
|
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
123 def close(self): |
|
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
124 self.conn.close() |
|
62de601bdf6f
Fix commits although a Reject exception is raised
Ralf Schlatterbeck <rsc@runtux.com>
parents:
5252
diff
changeset
|
125 |
|
2082
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
126 class Sessions(BasicDatabase): |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
127 name = 'session' |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
128 |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
129 class OneTimeKeys(BasicDatabase): |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
130 name = 'otk' |
|
c091cacdc505
Finished implementation of session and one-time-key stores for RDBMS backends.
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
131 |
|
3920
416606b09b27
fix vim modelines
Justus Pendleton <jpend@users.sourceforge.net>
parents:
3918
diff
changeset
|
132 # vim: set et sts=4 sw=4 : |
