Skip to content

Commit de821a7

Browse files
author
Richard Jones
committed
handle deprecation of FCNTL in python2.2+
1 parent f14e322 commit de821a7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

roundup/mailgw.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373
an exception, the original message is bounced back to the sender with the
7474
explanatory message given in the exception.
7575
76-
$Id: mailgw.py,v 1.121 2003-04-27 02:16:46 richard Exp $
76+
$Id: mailgw.py,v 1.122 2003-06-18 23:31:52 richard Exp $
7777
'''
7878

7979
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
@@ -221,7 +221,12 @@ def do_mailbox(self, filename):
221221
pass each to the mail handler.
222222
'''
223223
# open the spool file and lock it
224-
import fcntl, FCNTL
224+
import fcntl
225+
# FCNTL is deprecated in py2.3 and fcntl takes over all the symbols
226+
if hasattr(fcntl, 'LOCK_EX'):
227+
FCNTL = fcntl
228+
else:
229+
import FCNTL
225230
f = open(filename, 'r+')
226231
fcntl.flock(f.fileno(), FCNTL.LOCK_EX)
227232

0 commit comments

Comments
 (0)