Permalink
Browse files

fix on python 2

  • Loading branch information...
1 parent 868da06 commit 9de333b213653fdcb85287fd49dd7986ae81e5f8 @mcdonc mcdonc committed Sep 27, 2011
Showing with 10 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +9 −4 pyramid_exclog/__init__.py
View
@@ -13,3 +13,4 @@ nosetests.xml
pyramid_exclog/coverage.xml
env26/
env27/
+env32/
View
@@ -1,24 +1,29 @@
import logging
+import sys
from pyramid.tweens import EXCVIEW
from pyramid.settings import aslist
from pyramid.util import DottedNameResolver
from pyramid.httpexceptions import WSGIHTTPException
-from pyramid.compat import PY3
resolver = DottedNameResolver(None)
-try:
+PY3 = sys.version_info[0] == 3
+
+if PY3: # pragma: no cover
import builtins
-except ImportError: # pragma: no cover
+else:
import __builtin__ as builtins
def as_globals_list(value):
L = []
value = aslist(value)
for dottedname in value:
if dottedname in builtins.__dict__:
- dottedname = 'builtins.%s' % dottedname
+ if PY3: # pragma: no cover
+ dottedname = 'builtins.%s' % dottedname
+ else:
+ dottedname = '__builtin__.%s' % dottedname
obj = resolver.resolve(dottedname)
L.append(obj)
return L

0 comments on commit 9de333b

Please sign in to comment.