Skip to content

Commit

Permalink
Fix the import_object ImportError on Python 3.
Browse files Browse the repository at this point in the history
Python 3 also changed exception messages slightly so remove one case
from the doctest.
  • Loading branch information
bdarnell committed Apr 14, 2013
1 parent 55d3394 commit eb710ff
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions tornado/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import zlib


import sys

class ObjectDict(dict):
"""Makes a dictionary behave like an object, with attribute-style access.
"""
Expand Down Expand Up @@ -75,10 +73,6 @@ def import_object(name):
True
>>> import_object('tornado') is tornado
True
>>> import_object('missing_module')
Traceback (most recent call last):
...
ImportError: No module named missing_module
>>> import_object('tornado.missing_module')
Traceback (most recent call last):
...
Expand All @@ -92,8 +86,8 @@ def import_object(name):
try:
return getattr(obj, parts[-1])
except AttributeError:
exc_info = sys.exc_info()
raise ImportError, "No module named %s" % parts[-1], exc_info[2]
raise ImportError("No module named %s" % parts[-1])


# Fake unicode literal support: Python 3.2 doesn't have the u'' marker for
# literal strings, and alternative solutions like "from __future__ import
Expand Down

0 comments on commit eb710ff

Please sign in to comment.