changeset 1664:2ff95415ffb2

handle deprecation of FCNTL in python2.2+
author Richard Jones <richard@users.sourceforge.net>
date Wed, 18 Jun 2003 23:31:52 +0000
parents 09f0a54829eb
children dc543c28a7d0
files roundup/mailgw.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/mailgw.py	Wed Jun 18 11:15:13 2003 +0000
+++ b/roundup/mailgw.py	Wed Jun 18 23:31:52 2003 +0000
@@ -73,7 +73,7 @@
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception. 
 
-$Id: mailgw.py,v 1.121 2003-04-27 02:16:46 richard Exp $
+$Id: mailgw.py,v 1.122 2003-06-18 23:31:52 richard Exp $
 '''
 
 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
@@ -221,7 +221,12 @@
             pass each to the mail handler.
         '''
         # open the spool file and lock it
-        import fcntl, FCNTL
+        import fcntl
+        # FCNTL is deprecated in py2.3 and fcntl takes over all the symbols
+        if hasattr(fcntl, 'LOCK_EX'):
+            FCNTL = fcntl
+        else:
+            import FCNTL
         f = open(filename, 'r+')
         fcntl.flock(f.fileno(), FCNTL.LOCK_EX)
 

Roundup Issue Tracker: http://roundup-tracker.org/