1
2
3
4
5
6
7
8
9
10
11
12
13 import logging
14 from threading import Thread
15
17 """
18 Thread running inside zope that has its own read-only connection to the db.
19 """
20
22 Thread.__init__(self)
23 self.setDaemon(1)
24
25
27 """Open a connection to the zope database.
28 """
29 from Zope2 import DB
30 self.conn = DB.open()
31 root = self.conn.root()
32 self.app = root['Application']
33
34
36 """Sync the connection to the zope database.
37 """
38 self.conn.sync()
39
40
42 """Abort our transaction (we are read-only) and close connection.
43 """
44 try:
45 import transaction
46 transaction.abort()
47 self.conn.close()
48 except:
49 pass
50