[Zope-Checkins] CVS: Zope/ZServer/medusa - asyncore.py:1.19

Brian Lloyd brian@zope.com
Thu, 20 Jun 2002 09:40:03 -0400


Update of /cvs-repository/Zope/ZServer/medusa
In directory cvs.zope.org:/tmp/cvs-serv12096

Modified Files:
	asyncore.py 
Log Message:
Fix for bug 151: Python 2.1 / 2.2 compatibility hack for fcntl wasn't 
installed when using medusa directly (e.g. monitor_client).


=== Zope/ZServer/medusa/asyncore.py 1.18 => 1.19 ===
     import fcntl
 
+    # HACK by ZC: this hack also appears in ZServer.__init__, but it
+    # doesn't get installed if someone uses medusa directly (as they
+    # would when running the monitor client. This ensures that the
+    # compatibility hack is installed. Hopefully this (and any other)
+    # hacks can go away when we move to Python 2.2.
+    if not hasattr(fcntl, 'F_GETFL'):
+        import FCNTL
+        fcntl.F_GETFL = FCNTL.F_GETFL
+        fcntl.F_SETFL = FCNTL.F_SETFL
+
+
     class file_wrapper:
         # here we override just enough to make a file
         # look like a socket for the purposes of asyncore.