Merge branch 'joshfriend-colour-import'
This commit is contained in:
3
setup.py
3
setup.py
@@ -35,7 +35,8 @@ extras_require = {
|
||||
'psycopg2>=2.5.1',
|
||||
'pytz>=2014.2',
|
||||
'python-dateutil>=2.2',
|
||||
'pymysql'
|
||||
'pymysql',
|
||||
'colour>=0.0.4'
|
||||
],
|
||||
'anyjson': ['anyjson>=0.3.3'],
|
||||
'babel': ['Babel>=1.3'],
|
||||
|
||||
@@ -6,8 +6,9 @@ from .scalar_coercible import ScalarCoercible
|
||||
colour = None
|
||||
try:
|
||||
import colour
|
||||
python_colour_type = colour.Color
|
||||
except ImportError:
|
||||
pass
|
||||
python_colour_type = None
|
||||
|
||||
|
||||
class ColorType(types.TypeDecorator, ScalarCoercible):
|
||||
@@ -49,7 +50,7 @@ class ColorType(types.TypeDecorator, ScalarCoercible):
|
||||
"""
|
||||
STORE_FORMAT = u'hex'
|
||||
impl = types.Unicode(20)
|
||||
python_type = colour.Color
|
||||
python_type = python_colour_type
|
||||
|
||||
def __init__(self, max_length=20, *args, **kwargs):
|
||||
# Fail if colour is not found.
|
||||
|
||||
@@ -6,7 +6,7 @@ from sqlalchemy_utils.types import color
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
@mark.skipif('color.colour is None')
|
||||
@mark.skipif('color.python_colour_type is None')
|
||||
class TestColorType(TestCase):
|
||||
def create_models(self):
|
||||
class Document(self.Base):
|
||||
|
||||
Reference in New Issue
Block a user