source: WAeUP_SRP/branches/joachim-azax-branch/PatchZODBConnectionOpen.py @ 3466

Last change on this file since 3466 was 1847, checked in by joachim, 17 years ago

Patch of searchResults is not neccessary, if permission
"Access inactive portal content" is set for authenticated in uniben-root.

  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1from ZODB.Connection import Connection
2from time import time
3import transaction
4
5global_reset_counter = 0
6
7def open(self, transaction_manager=None, mvcc=True, synch=True,
8            delegate=True):
9    """Register odb, the DB that this Connection uses.
10
11    This method is called by the DB every time a Connection
12    is opened.  Any invalidations received while the Connection
13    was closed will be processed.
14
15    If the global module function resetCaches() was called, the
16    cache will be cleared.
17
18    Parameters:
19    odb: database that owns the Connection
20    mvcc: boolean indicating whether MVCC is enabled
21    transaction_manager: transaction manager to use.  None means
22        use the default transaction manager.
23    synch: boolean indicating whether Connection should
24    register for afterCompletion() calls.
25    """
26
27    # TODO:  Why do we go to all the trouble of setting _db and
28    # other attributes on open and clearing them on close?
29    # A Connection is only ever associated with a single DB
30    # and Storage.
31
32    self._opened = time()
33    self._synch = synch
34    self._mvcc = mvcc and not self._version
35    if transaction_manager is None:
36        transaction_manager = transaction.manager
37
38    self.transaction_manager = transaction_manager
39
40    # js 28-5-2007 always call _flush_invalidations
41    self._flush_invalidations()
42    if self._reset_counter != global_reset_counter:
43        # New code is in place.  Start a new cache.
44        self._resetCache()
45    # else:
46    #     import pdb; pdb.set_trace()
47    #     self._flush_invalidations()
48
49    if synch:
50        transaction_manager.registerSynch(self)
51
52    if self._cache is not None:
53        self._cache.incrgc() # This is a good time to do some GC
54
55    if delegate:
56        # delegate open to secondary connections
57        for connection in self.connections.values():
58            if connection is not self:
59                connection.open(transaction_manager, mvcc, synch, False)
60
61Connection.open = open
Note: See TracBrowser for help on using the repository browser.