Skip to content
Myr

Simplify splitting import_name in import_string()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Min ho Kim · committed by Min ho Kim · parent 9a877fa · Browse files · 1 file+1 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−3 removed

  • other:+1 added−3 removed

1 file+1 added−3 removed

modified:jinja2/utils.py+1 added-3 removed
134 unmodified lines
135 try:136 if ':' in import_name:137 module, obj = import_name.split(':', 1)138 elif '.' in import_name:139 items = import_name.split('.')140 module = '.'.join(items[:-1])141 obj = items[-1]139 module, _, obj = import_name.rpartition('.')140 else:141 return __import__(import_name)142 return getattr(__import__(module, None, None, [obj]), obj)143 except (ImportError, AttributeError):
506 unmodified lines