Beispiel #1
0
	def load_standard_properties(self, context):
		'''load templates and run get_context'''
		module = get_doc_module(self.module, self.doctype, self.name)
		if module:
			if hasattr(module, 'get_context'):
				out = module.get_context(context)
				if out: context.update(out)

		self.message = self.get_template()

		if not is_html(self.message):
			self.message = markdown(self.message)
Beispiel #2
0
	def get_template(self):
		module = get_doc_module(self.module, self.doctype, self.name)
		def load_template(extn):
			template = ''
			template_path = os.path.join(os.path.dirname(module.__file__),
				frappe.scrub(self.name) + extn)
			if os.path.exists(template_path):
				with open(template_path, 'r') as f:
					template = f.read()
			return template

		return load_template('.html') or load_template('.md')
Beispiel #3
0
	def load_standard_properties(self, context):
		module = get_doc_module(self.module, self.doctype, self.name)
		if module:
			if hasattr(module, 'get_context'):
				out = module.get_context(context)
				if out: context.update(out)

			def load_template(extn):
				template_path = os.path.join(os.path.dirname(module.__file__),
					frappe.scrub(self.name) + extn)
				if os.path.exists(template_path):
					with open(template_path, 'r') as f:
						self.message = f.read()
					return True

			# get template
			if not load_template('.html'):
				if load_template('.md'):
					self.message = markdown(self.message)
Beispiel #4
0
	def set_web_form_module(self):
		'''Get custom web form module if exists'''
		if self.is_standard:
			self.web_form_module = get_doc_module(self.module, self.doctype, self.name)
		else:
			self.web_form_module = None
Beispiel #5
0
 def get_web_form_module(self):
     if self.is_standard:
         return get_doc_module(self.module, self.doctype, self.name)
Beispiel #6
0
	def set_web_form_module(self):
		'''Get custom web form module if exists'''
		if self.is_standard:
			self.web_form_module = get_doc_module(self.module, self.doctype, self.name)
		else:
			self.web_form_module = None