Просмотр исходного кода

Don't rely on case-sensitive imports, fix #282

We should burn PEP 235, bicameral scripts, encodings, Python2/3 compatibility,
Windows, MacOS X, filenames, unicode (including composite characters), and the
whole world. And LF/CR too, of course.

Let's recreate a language relying on only two characters. Anyone interested?
Guillaume Ayoub 11 лет назад
Родитель
Сommit
e69bec1272
1 измененных файлов с 5 добавлено и 6 удалено
  1. 5 6
      radicale/rights/regex.py

+ 5 - 6
radicale/rights/regex.py

@@ -39,19 +39,18 @@ Leading or ending slashes are trimmed from collection's path.
 """
 
 import re
+import sys
 import os.path
 
 from .. import config, log
 
 # Manage Python2/3 different modules
-# pylint: disable=F0401
-try:
-    from configparser import ConfigParser
-    from io import StringIO
-except ImportError:
+if sys.version_info[0] == 2:
     from ConfigParser import ConfigParser
     from StringIO import StringIO
-# pylint: enable=F0401
+else:
+    from configparser import ConfigParser
+    from io import StringIO
 
 
 DEFINED_RIGHTS = {