Example #1
0
	def get_template_folder(self):
		"""Return the absolute path to the template's folder."""
		module = self.module or "Website"
		module_path = get_module_path(module)
		doctype, docname = scrub_dt_dn(self.doctype, self.name)

		return os.path.join(module_path, doctype, docname)
Example #2
0
def get_rendered_template(web_template, values):
    standard = frappe.db.get_value("Web Template", web_template, "standard")
    if standard:
        module_path = get_module_path("Website")
        dt, dn = scrub_dt_dn("Web Template", web_template)
        scrubbed = frappe.scrub(web_template)
        full_path = os.path.join("frappe", module_path, dt, dn,
                                 scrubbed + ".html")
        root_app_path = os.path.abspath(
            os.path.join(frappe.get_app_path('frappe'), '..'))
        template = os.path.relpath(full_path, root_app_path)
    else:
        template = frappe.db.get_value("Web Template", web_template,
                                       "template")

    context = values or {}
    context.update({'values': values})
    return frappe.render_template(template, context)