[Zodb-checkins] CVS: StandaloneZODB/ZEO - start.py:1.29.2.2

Jeremy Hylton jeremy@zope.com
Thu, 28 Mar 2002 15:30:03 -0500


Update of /cvs-repository/StandaloneZODB/ZEO
In directory cvs.zope.org:/tmp/cvs-serv22112

Modified Files:
      Tag: zeo-1_0-debug-branch
	start.py 
Log Message:
Reformat some code for readability.


=== StandaloneZODB/ZEO/start.py 1.29.2.1 => 1.29.2.2 ===
 
             signal.signal(signal.SIGTERM,
-                          lambda sig, frame, s=storages: shutdown(s)
-                          )
+                          lambda sig, frame, s=storages: shutdown(s))
             signal.signal(signal.SIGINT,
-                          lambda sig, frame, s=storages: shutdown(s, 0)
-                          )
-            try: signal.signal(signal.SIGHUP, rotate_logs_handler)
-            except: pass
-
-        except: pass
+                          lambda sig, frame, s=storages: shutdown(s, 0))
+            try:
+                signal.signal(signal.SIGHUP, rotate_logs_handler)
+            except:
+                pass
+        except:
+            pass
 
         items=storages.items()
         items.sort()
@@ -236,13 +236,16 @@
 
         ZEO.StorageServer.StorageServer(unix, storages)
 
-        try: ppid, pid = os.getppid(), os.getpid()
-        except: pass # getpid not supported
-        else: open(zeo_pid,'w').write("%s %s" % (ppid, pid))
+        try:
+            ppid, pid = os.getppid(), os.getpid()
+        except:
+            pass # getpid not supported
+        else:
+            open(zeo_pid,'w').write("%s %s" % (ppid, pid))
 
     except:
         # Log startup exception and tell zdaemon not to restart us.
-        info=sys.exc_info()
+        info = sys.exc_info()
         try:
             import zLOG
             zLOG.LOG("z2", zLOG.PANIC, "Startup exception",
@@ -280,21 +283,29 @@
     # unnecessary, since we now use so_reuseaddr.
     for ignored in 1,2:
         for socket in asyncore.socket_map.values():
-            try: socket.close()
-            except: pass
+            try:
+                socket.close()
+            except:
+                pass
 
     for storage in storages.values():
-        try: storage.close()
-        except: pass
+        try:
+            storage.close()
+        except:
+            pass
 
     try:
         from zLOG import LOG, INFO
         LOG('ZEO Server', INFO,
             "Shutting down (%s)" % (die and "shutdown" or "restart")
             )
-    except: pass
+    except:
+        pass
     
-    if die: sys.exit(0)
-    else: sys.exit(1)
+    if die:
+        sys.exit(0)
+    else:
+        sys.exit(1)
 
-if __name__=='__main__': main(sys.argv)
+if __name__ == '__main__':
+    main(sys.argv)