Merge pull request #4835 from pratu16x7/hotfix

[fix] slideshow private images validation
This commit is contained in:
Prateeksha Singh 2018-01-15 20:52:39 +05:30 committed by GitHub
commit b43e888e0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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