Skip to content

Commit

Permalink
v1.1.1 - fix Django import when you have it installed, but aren't in …
Browse files Browse the repository at this point in the history
…a project
  • Loading branch information
Someguy123 committed Jun 22, 2019
1 parent 904dab7 commit bbe367f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions privex/helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,21 @@ def _setup_logging(level=logging.WARNING):

name = 'helpers'

class ImproperlyConfigured(Exception):
"""Placeholder in-case this fails to import from django.core.exceptions"""
pass

# Only import the Django functions if Django is actually installed
try:
import django
from django.core.exceptions import ImproperlyConfigured
from privex.helpers.django import *
except ImportError:
log.debug('privex.helpers __init__ failed to import "django", not loading django helpers')
pass
except ImproperlyConfigured:
log.debug('privex.helpers __init__ failed to import "django", not loading django helpers')
pass


from privex.helpers.common import *
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
setup(
name='privex_helpers',

version='1.1.0',
version='1.1.1',

description='A variety of helper functions and classes, useful for many different projects',
long_description=long_description,
Expand Down

0 comments on commit bbe367f

Please sign in to comment.