From 3995fd8582e680272ad921839f769635084846b7 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Mon, 15 Jan 2018 20:45:31 +0530 Subject: [PATCH] [fix] slideshow private images validation --- .../website/doctype/website_slideshow/website_slideshow.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frappe/website/doctype/website_slideshow/website_slideshow.py b/frappe/website/doctype/website_slideshow/website_slideshow.py index 467fd80e2e..a287ae2a20 100644 --- a/frappe/website/doctype/website_slideshow/website_slideshow.py +++ b/frappe/website/doctype/website_slideshow/website_slideshow.py @@ -21,9 +21,10 @@ class WebsiteSlideshow(Document): def validate_images(self): ''' atleast one image file should be public for slideshow ''' files = map(lambda row: row.image, self.slideshow_items) - result = frappe.get_all("File", filters={ "file_url":("in", files) }, fields="is_private") - if any([file.is_private for file in result]): - frappe.throw(_("All Images attached to Website Slideshow should be public")) + if files: + result = frappe.get_all("File", filters={ "file_url":("in", files) }, fields="is_private") + if any([file.is_private for file in result]): + frappe.throw(_("All Images attached to Website Slideshow should be public")) def get_slideshow(doc): if not doc.slideshow: