Example #1
0
	def connect(self, on_error_send_email=True):
		if self.user=="Guest":
			return

		try:
			if not self.doc:
				self.get_jasperconfig_from_db()

			self.session = frappe.local.jasper_session = jasper.session(self.doc.get("jasper_server_url").strip(), self.doc.get("jasper_username"), self.doc.get("jasper_server_password"))

			self.update_cookie()
			self.is_login = True

		except Exception as e:
			self.is_login = False
			if on_error_send_email:
				sessionId = "connect_error"
				msg = _("Jasper Server, login error. Reason: {}".format(e))
				title = _("Jasper Server, login error")
				self.send_mail_and_logger(sessionId, msg, title)
	def connect(self, on_error_send_email=True):
		if self.user=="Guest":
			return

		try:
			if not self.doc:
				self.get_jasperconfig_from_db()

			self.session = frappe.local.jasper_session = jasper.session(self.doc.get("jasper_server_url").strip(), self.doc.get("jasper_username"), self.doc.get("jasper_server_password"))

			self.update_cookie()
			self.is_login = True

		except Exception as e:
			self.is_login = False
			if on_error_send_email:
				sessionId = "connect_error"
				msg = _("Jasper Server, login error. Reason: {}".format(e))
				title = _("Jasper Server, login error")
				self.send_mail_and_logger(sessionId, msg, title)
Example #3
0
import os
import pprint
import json
import base64
from time import sleep

import jasperserverlib.core as jasper
from jasperserverlib.repo_search import Search
from jasperserverlib.resource_details import Details
from jasperserverlib.resource_download import DownloadBinary
from jasperserverlib.report import Report
from jasperserverlib.core.resource_search_param import ResourceSearchParameter as rsp

pp = pprint.PrettyPrinter(indent=4)

session = jasper.session('http://localhost:8090/jasperserverlib', 'jasperadmin', 'jasperadmin')

#s = Search(session)

#s.search(path="/reports/erpnext")

#pp.pprint(s.getDescriptor())

d = Details(session, "/reports/testFolder/Example")
pp.pprint(d.serverInfo())
#pp.pprint(d.details().getDescriptor())
#print "desc: {}".format(d.details().getDescriptor())

#/themes/default/buttons.css
#dl = DownloadBinary(session, "/reports/testFolder/Example_files/main_jrxml")
#dl.downloadBinary()
Example #4
0
	def resume_connection(self):
		self.session = frappe.local.jasper_session = jasper.session(self.doc.get("jasper_server_url").strip(), resume=True)
		if self.session:
			self.session.resume(self.data['data']['cookie'])
			self.is_login = True
	def resume_connection(self):
		self.session = frappe.local.jasper_session = jasper.session(self.doc.get("jasper_server_url").strip(), resume=True)
		if self.session:
			self.session.resume(self.data['data']['cookie'])
			self.is_login = True