Ejemplo n.º 1
0
	def on_update(self):
		clear_cache(website_group=self.doc.website_group)
		clear_post_cache(self.doc.parent_post or self.doc.name)

		if self.doc.assigned_to and self.doc.assigned_to != self.assigned_to \
			and webnotes.session.user != self.doc.assigned_to:
			
			# send assignment email
			sendmail(recipients=[self.doc.assigned_to], 
				subject="You have been assigned this Task by {}".format(get_fullname(self.doc.modified_by)),
				msg=self.get_reply_email_message(self.doc.name, get_fullname(self.doc.owner)))
Ejemplo n.º 2
0
def clear_cache(page_name=None, website_group=None):
	if page_name or website_group:
		filters = {"page_name": page_name} if page_name else website_group

		website_group = webnotes.conn.get_value("Website Group", filters,
			["page_name", "group_type"], as_dict=True)

		if not website_group:
			return

		website_groups = [website_group]
	else:
		clear_post_cache()
		website_groups = webnotes.conn.sql("""select page_name, group_type from `tabWebsite Group`""", as_dict=True)
	
	cache = webnotes.cache()
	for group in website_groups:
		for view in get_views(group.group_type):
			cache.delete_value("website_group_context:{}:{}".format(group.page_name, view))