[Checkins] SVN: cipher.background/trunk/ Refactor BackgroundWorkerThread to have the site returned from getSite()

Adam Groszer cvs-admin at zope.org
Tue Jul 31 15:56:11 UTC 2012


Log message for revision 127407:
  Refactor BackgroundWorkerThread to have the site returned from getSite()

Changed:
  U   cipher.background/trunk/CHANGES.txt
  U   cipher.background/trunk/src/cipher/background/thread.py

-=-
Modified: cipher.background/trunk/CHANGES.txt
===================================================================
--- cipher.background/trunk/CHANGES.txt	2012-07-30 17:48:55 UTC (rev 127406)
+++ cipher.background/trunk/CHANGES.txt	2012-07-31 15:56:06 UTC (rev 127407)
@@ -6,7 +6,7 @@
 1.0.2 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Refactor BackgroundWorkerThread to have the site returned from getSite()
 
 
 1.0.1 (2012-04-05)

Modified: cipher.background/trunk/src/cipher/background/thread.py
===================================================================
--- cipher.background/trunk/src/cipher/background/thread.py	2012-07-30 17:48:55 UTC (rev 127406)
+++ cipher.background/trunk/src/cipher/background/thread.py	2012-07-31 15:56:06 UTC (rev 127407)
@@ -87,6 +87,9 @@
                     site_name=self.site_name,
                     user_name=self.user_name)
 
+    def getSite(self, connection):
+        return connection.get(self.site_oid)
+
     def run(self):
         """Main loop of the thread."""
         try:
@@ -94,7 +97,7 @@
                 with ZopeInteraction():
                     with ZodbConnection(self.site_db) as conn:
                         try:
-                            with ZopeSite(conn.get(self.site_oid)):
+                            with ZopeSite(self.getSite(conn)):
                                 try:
                                     with ZopeTransaction(
                                             user=self.user_name,
@@ -146,4 +149,3 @@
         Cleanup is also called when doWork() raises an exception.  It is
         performed in a separate transaction.  It can access the site.
         """
-



More information about the checkins mailing list