Merge branch 'joshfriend-colour-import'

This commit is contained in:
Konsta Vesterinen
2014-12-13 21:52:05 +02:00
3 changed files with 6 additions and 4 deletions

View File

@@ -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'],

View File

@@ -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.

View File

@@ -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):