Skip to content

Commit

Permalink
Do not fail on import when parsing urls (Fix #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
noirbizarre committed Jul 4, 2013
1 parent 3fde880 commit 19abb1a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions djangojs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@ def urls_as_json():
def _get_urls(module, prefix='', namespace=None):
urls = {}
if isinstance(module, (six.text_type, six.string_types)):
__import__(module)
root_urls = sys.modules[module]
patterns = root_urls.urlpatterns
try:
__import__(module)
root_urls = sys.modules[module]
patterns = root_urls.urlpatterns
except ImportError: # die silently
patterns = tuple()
elif isinstance(module, (list, tuple)):
patterns = module
elif isinstance(module, types.ModuleType):
Expand Down

0 comments on commit 19abb1a

Please sign in to comment.