def get_jasper_reqid_data(self, reqId):
     print "reqId %s" % reqId
     data = utils.get_jasper_data(
         reqId,
         get_from_db=self.get_jasper_reqid_data_from_db,
         args=[reqId])
     if not data:
         utils.delete_jasper_session(
             reqId, "tabJasperReqids where reqid='%s'" % reqId)
     return frappe._dict({'data': data})
	def save_html_cache(self, report_name, reportPath):
		name = "client_html_" + report_name.replace(" ", "_")
		new_data = frappe._dict({'data': {}})
		data = utils.get_jasper_data(name, get_from_db=self.get_session_from_db, tab="tabJasperClientHtmlDocs")
		if data:
			rp = data['data']['reportPath']
			if rp == reportPath:
				data['data']['hash'] = self.html_hash
				utils.update_list_all_memcache_db(data, cachename=name)
				return
		new_data['data']['reportPath'] = reportPath
		new_data['data']['hash'] = self.html_hash
		utils.insert_list_all_memcache_db(new_data['data'], cachename=name)
Пример #3
0
	def save_html_cache(self, report_name, reportPath):
		name = "client_html_" + report_name.replace(" ", "_")
		new_data = frappe._dict({'data': {}})
		data = utils.get_jasper_data(name, get_from_db=self.get_session_from_db, tab="tabJasperClientHtmlDocs")
		if data:
			rp = data['data']['reportPath']
			if rp == reportPath:
				data['data']['hash'] = self.html_hash
				utils.update_list_all_memcache_db(data, cachename=name)
				return
		new_data['data']['reportPath'] = reportPath
		new_data['data']['hash'] = self.html_hash
		utils.insert_list_all_memcache_db(new_data['data'], cachename=name)
def clear_jasper_sessions(force=True):
    removed = 0
    sid = "jaspersession"
    deleted = force
    data = get_jasper_data(sid)
    if not data:
        return removed

    if not force:
        deleted = _f(data)
    if deleted:
        frappe.cache().delete_value("jasper:" + sid)
        removed += 1
        frappe.db.sql("""delete from `tabJasperSessions` """)
        if force:
            version = getFrappeVersion().major
            if version > 4:
                clear_all_jasper_from_redis_cache()
            else:
                clear_all_jasper_from_cache_v4()

        print _("was removed {0} jaspersession(s)".format(removed))

    return removed
def clear_jasper_sessions(force=True):
	removed = 0
	sid = "jaspersession"
	deleted = force
	data = get_jasper_data(sid)
	if not data:
		return removed

	if not force:
		deleted = _f(data)
	if deleted:
		frappe.cache().delete_value("jasper:" + sid)
		removed += 1
		frappe.db.sql("""delete from `tabJasperSessions` """)
		if force:
			version = getFrappeVersion().major
			if version > 4:
				clear_all_jasper_from_redis_cache()
			else:
				clear_all_jasper_from_cache_v4()

		print _("was removed {0} jaspersession(s)".format(removed))

	return removed
	def get_jasper_session_data(self):
		data = utils.get_jasper_data("jaspersession")
		if not data:
			self.delete_jasper_session()
		return data
	def get_jasper_reqid_data(self, reqId):
		data = utils.get_jasper_data(reqId, get_from_db=self.get_jasper_reqid_data_from_db, args=[reqId])
		if not data:
			utils.delete_jasper_session(reqId, "tabJasperReqids where reqid='%s'" % reqId)
		return frappe._dict({'data': data})
Пример #8
0
	def get_jasper_session_data(self):
		data = utils.get_jasper_data("jaspersession")
		if not data:
			self.delete_jasper_session()
		return data