Skip to content

Commit

Permalink
Fix import used to determine file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemacfarlane committed Oct 11, 2014
1 parent 5adbc8b commit 9ba9d78
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/z3c/rml/attr.py
Expand Up @@ -27,6 +27,13 @@
import zope.schema
from lxml import etree

try:
from importlib import import_module
except ImportError:
# XXX Python 2.6 doesn't have importlib
def import_module(modulepath):
return __import__(modulepath, {}, {}, (modulepath))

from z3c.rml import interfaces, SampleStyleSheet

MISSING = object()
Expand Down Expand Up @@ -325,7 +332,7 @@ def fromUnicode(self, value):
'The package-path-pair you specified was incorrect. %s' %(
getFileInfo(self.context)))
modulepath, path = result.groups()
module = __import__(modulepath, {}, {}, (modulepath))
module = import_module(modulepath)
value = os.path.join(os.path.dirname(module.__file__), path)
# If there is a drive name in the path, then we want a local file to
# be opened. This is only interesting for Windows of course.
Expand Down

0 comments on commit 9ba9d78

Please sign in to comment.