Browse Source

Use ConfigParser.read_file if available.

Jelmer Vernooij 8 năm trước cách đây
mục cha
commit
4b93fbdc0a
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      dulwich/contrib/swift.py

+ 5 - 1
dulwich/contrib/swift.py

@@ -172,7 +172,11 @@ def load_conf(path=None, file=None):
     """
     conf = ConfigParser()
     if file:
-        conf.readfp(file)
+        try:
+            conf.read_file(file, path)
+        except AttributeError:
+            # read_file only exists in Python3
+            conf.readfp(file)
         return conf
     confpath = None
     if not path: