dont assume presence of colour package (fixes #104)
This commit is contained in:
@@ -5,9 +5,9 @@ from .scalar_coercible import ScalarCoercible
|
|||||||
|
|
||||||
colour = None
|
colour = None
|
||||||
try:
|
try:
|
||||||
import colour
|
from colour import Colour as python_colour_type
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
python_colour_type = None
|
||||||
|
|
||||||
|
|
||||||
class ColorType(types.TypeDecorator, ScalarCoercible):
|
class ColorType(types.TypeDecorator, ScalarCoercible):
|
||||||
@@ -49,7 +49,7 @@ class ColorType(types.TypeDecorator, ScalarCoercible):
|
|||||||
"""
|
"""
|
||||||
STORE_FORMAT = u'hex'
|
STORE_FORMAT = u'hex'
|
||||||
impl = types.Unicode(20)
|
impl = types.Unicode(20)
|
||||||
python_type = colour.Color
|
python_type = python_colour_type
|
||||||
|
|
||||||
def __init__(self, max_length=20, *args, **kwargs):
|
def __init__(self, max_length=20, *args, **kwargs):
|
||||||
# Fail if colour is not found.
|
# Fail if colour is not found.
|
||||||
|
Reference in New Issue
Block a user