Require django >= 1.3.1 and rework __init__ to make installing easier.

Change-Id: I43c90755db4f9dfa4202d57b80f0b674e9a8a670
This commit is contained in:
Gabriel Hurley 2012-03-01 12:01:17 -08:00
parent d57a34c5b1
commit 28c1a252f4
2 changed files with 7 additions and 7 deletions

View File

@ -24,26 +24,26 @@ methods like :func:`~horizon.register` and :func:`~horizon.unregister`.
# Because this module is compiled by setup.py before Django may be installed
# in the environment we try importing Django and issue a warning but move on
# should that fail.
django = None
Horizon = None
try:
import django
from horizon.base import Horizon, Dashboard, Panel, Workflow
except ImportError:
import warnings
def simple_warn(message, category, filename, lineno, file=None, line=None):
return '%s: %s' % (category.__name__, message)
msg = ("Could not import Django. This is normal during installation.\n")
msg = ("Could not import Horizon dependencies. "
"This is normal during installation.\n")
warnings.formatwarning = simple_warn
warnings.warn(msg, Warning)
if django:
if Horizon:
# This can be removed once the upstream bug is fixed.
import django
if django.VERSION < (1, 4):
from horizon.utils import reverse_bugfix
from horizon.base import Horizon, Dashboard, Panel, Workflow
register = Horizon.register
unregister = Horizon.unregister
get_absolute_url = Horizon.get_absolute_url

View File

@ -1,5 +1,5 @@
# Horizon Core Requirements
Django==1.3.1
Django>=1.3
python-cloudfiles
python-dateutil