From e5c395f8b68d3471b3411f8841d3fd401a8f50d6 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 12 Mar 2013 18:20:06 +0530 Subject: [PATCH] fix in style settings color validation --- website/doctype/style_settings/style_settings.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/website/doctype/style_settings/style_settings.py b/website/doctype/style_settings/style_settings.py index bf46afb97d..91ca0a579e 100644 --- a/website/doctype/style_settings/style_settings.py +++ b/website/doctype/style_settings/style_settings.py @@ -53,13 +53,15 @@ class DocType: del self.doc.fields[f] def validate_colors(self): - if self.doc.page_background==self.doc.page_text: - webnotes.msgprint(_("Page text and background is same color. Please change."), - raise_exception=1) + if (self.doc.page_background or self.doc.page_text) and \ + self.doc.page_background==self.doc.page_text: + webnotes.msgprint(_("Page text and background is same color. Please change."), + raise_exception=1) - if self.doc.top_bar_background==self.doc.top_bar_foreground: - webnotes.msgprint(_("Top Bar text and background is same color. Please change."), - raise_exception=1) + if (self.doc.top_bar_background or self.doc.top_bar_foreground) and \ + self.doc.top_bar_background==self.doc.top_bar_foreground: + webnotes.msgprint(_("Top Bar text and background is same color. Please change."), + raise_exception=1) def prepare(self):