diff options
| author | Pepper <pepper@scannerjammer.com> | 2015-03-04 04:28:00 -0500 |
|---|---|---|
| committer | Pepper <pepper@scannerjammer.com> | 2015-03-04 04:28:00 -0500 |
| commit | ca18ef726002bd64d831bc90c26ebe1b42a70069 (patch) | |
| tree | 11ce746f8a2ba1d46ffe7ca8b53bdf06caf54e75 /gradient.py | |
| parent | 734114b9a6bed13883b9f33e3a5acafc52af07a9 (diff) | |
added is color
Diffstat (limited to 'gradient.py')
| -rwxr-xr-x | gradient.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gradient.py b/gradient.py index 6d2e15f..4d01f9b 100755 --- a/gradient.py +++ b/gradient.py @@ -18,6 +18,11 @@ import sha #logger.setLevel(logging.WARNING)
#}}}
+def is_color(s):
+ if re.match('(rgba?\([0-9]+,[0-9]+,[0-9]+\))|([a-zA-Z]+)|(\#[A-Ha-h0-9]+)', s):
+ return s
+ else:
+ raise ValueError
PARAM_LIST = [
"width", "height",
"color1", "color2",
@@ -98,7 +103,7 @@ class Gradient: for key in PARAM_LIST:
if key in form:
if key in ['color1', 'color2']:
- params[key] = form[key]
+ params[key] = is_color(form[key])
else:
params[key] = sanitize(form[key])
|
