community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1713752 - /comdev/reporter.apache.org/trunk/scripts/readldap.py
Date Wed, 11 Nov 2015 01:16:48 GMT
Author: sebb
Date: Wed Nov 11 01:16:48 2015
New Revision: 1713752

URL: http://svn.apache.org/viewvc?rev=1713752&view=rev
Log:
Make work with Python2
(At present ldap3 is only installed for Python2 due to limitations in Puppet)

Modified:
    comdev/reporter.apache.org/trunk/scripts/readldap.py

Modified: comdev/reporter.apache.org/trunk/scripts/readldap.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/readldap.py?rev=1713752&r1=1713751&r2=1713752&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/readldap.py (original)
+++ comdev/reporter.apache.org/trunk/scripts/readldap.py Wed Nov 11 01:16:48 2015
@@ -3,7 +3,12 @@
    Read auth groups from LDAP
    
 """
-
+import sys
+if sys.hexversion < 0x03000000:
+    _PY3 = False
+    from io import open
+else:
+    _PY3 = True
 from os.path import getmtime
 import json
 import time, calendar
@@ -92,7 +97,7 @@ def getLDAPjson(key, unix=True):
             if diff < 300:
                 print("Recently checked " + filename + ' ' + str(diff))
                 return old
-    except FileNotFoundError:
+    except IOError:
         print("No file found " + filename)
         old = {}
     try:



Mime
View raw message