@@ -533,6 +533,7 @@ def get_jenv(): | |||
global jenv | |||
if not jenv: | |||
from jinja2 import Environment, ChoiceLoader, PackageLoader, DebugUndefined | |||
import webnotes.utils | |||
apps = get_installed_apps() | |||
apps.remove("webnotes") | |||
@@ -543,10 +544,16 @@ def get_jenv(): | |||
set_filters(jenv) | |||
jenv.globals.update({ | |||
"webnotes": sys.modules[__name__], | |||
"webnotes.utils": webnotes.utils | |||
}) | |||
return jenv | |||
def set_filters(jenv): | |||
from webnotes.utils import global_date_format, scrub_relative_url | |||
from webnotes.webutils import get_hex_shade | |||
from markdown2 import markdown | |||
from json import dumps | |||
@@ -554,6 +561,7 @@ def set_filters(jenv): | |||
jenv.filters["markdown"] = markdown | |||
jenv.filters["json"] = dumps | |||
jenv.filters["scrub_relative_url"] = scrub_relative_url | |||
jenv.filters["get_hex_shade"] = get_hex_shade | |||
# load jenv_filters from hooks.txt | |||
for app in get_all_apps(True): | |||
@@ -237,7 +237,8 @@ def use(): | |||
# install | |||
@cmd | |||
def install(db_name, root_login="root", root_password=None, source_sql=None, | |||
admin_password = 'admin', verbose=True, force=False, site_config=None, reinstall=False): | |||
admin_password = 'admin', verbose=True, force=False, site_config=None, reinstall=False): | |||
print db_name, source_sql | |||
from webnotes.installer import install_db, install_app, make_site_dirs | |||
install_db(root_login=root_login, root_password=root_password, db_name=db_name, source_sql=source_sql, | |||
admin_password = admin_password, verbose=verbose, force=force, site_config=site_config, reinstall=reinstall) | |||
@@ -36,6 +36,15 @@ def make(doctype=None, name=None, content=None, subject=None, sent_or_received = | |||
if doctype and name and not webnotes.has_permission(doctype, "email", name): | |||
raise webnotes.PermissionError("You are not allowed to send emails related to: {doctype} {name}".format( | |||
doctype=doctype, name=name)) | |||
_send(doctype=doctype, name=name, content=content, subject=subject, sent_or_received=sent_or_received, | |||
sender=sender, recipients=recipients, communication_medium=communication_medium, send_email=send_email, | |||
print_html=print_html, attachments=attachments, send_me_a_copy=send_me_a_copy, set_lead=set_lead, | |||
date=date) | |||
def _make(doctype=None, name=None, content=None, subject=None, sent_or_received = "Sent", | |||
sender=None, recipients=None, communication_medium="Email", send_email=False, | |||
print_html=None, attachments='[]', send_me_a_copy=False, set_lead=True, date=None): | |||
# add to Communication | |||
sent_via = None | |||
@@ -6,6 +6,7 @@ app_icon = icon-cog | |||
app_version = 4.0.0-wip | |||
app_color = #3498db | |||
before_install = webnotes.utils.install.before_install | |||
after_install = webnotes.utils.install.after_install | |||
# website | |||
@@ -14,6 +15,8 @@ app_include_css = assets/webnotes/css/splash.css | |||
app_include_css = assets/css/webnotes.css | |||
web_include_js = assets/js/webnotes-web.min.js | |||
web_include_css = assets/css/webnotes-web.css | |||
web_include_js = website_script.js | |||
web_include_css = style_settings.css | |||
website_group_handler:Forum = webnotes.templates.website_group.forum | |||
website_group_handler:Events = webnotes.templates.website_group.events | |||
@@ -9,4 +9,5 @@ execute:webnotes.reload_doc('core', 'doctype', 'report') #2013-13-26 | |||
webnotes.patches.4_0.remove_index_sitemap | |||
webnotes.patches.4_0.add_delete_permission | |||
webnotes.patches.4_0.move_match_to_restricted | |||
webnotes.patches.4_0.set_todo_checked_as_closed | |||
webnotes.patches.4_0.set_todo_checked_as_closed | |||
webnotes.patches.4_0.website_sitemap_hierarchy |
@@ -0,0 +1,22 @@ | |||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors | |||
# MIT License. See license.txt | |||
from __future__ import unicode_literals | |||
import webnotes | |||
def execute(): | |||
webnotes.reload_doc("website", "doctype", "website_sitemap") | |||
webnotes.reload_doc("website", "doctype", "website_sitemap_permission") | |||
webnotes.reload_doc("website", "doctype", "website_group") | |||
webnotes.reload_doc("website", "doctype", "post") | |||
webnotes.reload_doc("website", "doctype", "user_vote") | |||
webnotes.conn.sql("""update `tabWebsite Sitemap` ws set ref_doctype=(select wsc.ref_doctype | |||
from `tabWebsite Sitemap Config` wsc where wsc.name=ws.website_sitemap_config) | |||
where ifnull(page_or_generator, '')!='Page'""") | |||
home_page = webnotes.conn.get_value("Website Settings", "Website Settings", "home_page") | |||
home_page = webnotes.conn.get_value("Website Sitemap", {"docname": home_page}) or home_page | |||
webnotes.conn.set_value("Website Settings", "Website Settings", "home_page", | |||
home_page) |
@@ -10,33 +10,32 @@ | |||
<link rel="shortcut icon" href="{{ favicon | scrub_relative_url }}" type="image/x-icon"> | |||
<link rel="icon" href="{{ favicon | scrub_relative_url }}" type="image/x-icon"> | |||
{%- block head -%} | |||
{% block head -%} | |||
{%- if meta_description is defined -%} | |||
<meta name="description" content="{{ meta_description }}"> | |||
{%- endif -%} | |||
{%- for link in web_include_js -%} | |||
<script type="text/javascript" src="/{{ link }}"></script> | |||
<script type="text/javascript" src="{{ link | scrub_relative_url }}"></script> | |||
{%- endfor -%} | |||
{%- for link in web_include_css -%} | |||
<link type="text/css" rel="stylesheet" href="/{{ link }}"> | |||
<link type="text/css" rel="stylesheet" href="{{ link | scrub_relative_url }}"> | |||
{%- endfor -%} | |||
{%- endblock -%} | |||
{%- block javascript -%} | |||
{%- if javascript is defined -%} | |||
<script>{{ javascript }}</script> | |||
{%- endif -%} | |||
{%- endblock -%} | |||
{%- block css -%} | |||
{%- if css is defined -%} | |||
<style>{{ css }}</style> | |||
{%- endif -%} | |||
{%- endblock -%} | |||
{% block script -%} | |||
<script data-html-block="script"> | |||
{%- if script is defined -%}{{ script }}{%- endif -%} | |||
</script> | |||
{%- endblock %} | |||
{%- block style -%}{%- endblock -%} | |||
{% block style -%} | |||
<style data-html-block="style"> | |||
{%- if style is defined -%}{{ style }}{%- endif -%} | |||
</style> | |||
{%- endblock %} | |||
{%- endblock %} | |||
</head> | |||
<body> | |||
<div id="wrap"> | |||
@@ -60,12 +59,15 @@ | |||
</header> | |||
<div class="container page-container" id="page-{{ name or page_name }}"> | |||
<div class="row"> | |||
<div class="col-sm-9 page-content" data-html-block="content"> | |||
{%- block content -%}{{ content }}{%- endblock -%} | |||
</div> | |||
<div class="col-sm-3 page-sidebar" data-html-block="sidebar"> | |||
<div class="col-sm-3 col-sm-push-9 page-sidebar hidden-xs" data-html-block="sidebar"> | |||
{%- block sidebar -%}{%- if sidebar is defined -%}{{ sidebar }}{%- endif -%}{%- endblock -%} | |||
</div> | |||
<div class="col-sm-9 col-sm-pull-3 page-content" data-html-block="content"> | |||
<div class="text-right"><a class="visible-xs toggle-sidebar no-decoration"> | |||
<i class="icon-chevron-down"></i> | |||
</a></div> | |||
{%- block content -%}{{ content }}{%- endblock -%} | |||
</div> | |||
</div> | |||
</div> | |||
<footer class="page-footer"> | |||
@@ -67,4 +67,8 @@ $(function() { | |||
</script> | |||
{% endblock %} | |||
{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %} | |||
{% block sidebar %}{% include "templates/includes/sidebar.html" %}{% endblock %} | |||
{% block style %}{{ style }}{% endblock %} | |||
{% block script %}{{ script }}{% endblock %} |
@@ -13,7 +13,7 @@ def get_context(context): | |||
web_page = webnotes.bean(context.ref_doctype, context.docname) | |||
if web_page.doc.slideshow: | |||
get_slideshow(web_page) | |||
web_page.doc.fields.update(get_slideshow(web_page)) | |||
web_page.doc.meta_description = web_page.doc.description | |||
@@ -29,6 +29,11 @@ def get_context(context): | |||
from `tabComment` where comment_doctype="Web Page" | |||
and comment_docname=%s order by creation""", web_page.doc.name, as_dict=1) or [] | |||
web_page.doc.fields.update({ | |||
"style": web_page.doc.css or "", | |||
"script": web_page.doc.javascript or "" | |||
}) | |||
web_page.doc.fields.update(context) | |||
return render_blocks(web_page.doc.fields) | |||
@@ -3,24 +3,6 @@ | |||
// js inside blog page | |||
$(document).ready(function() { | |||
// make list of blogs | |||
blog.get_list(); | |||
$("#next-page").click(function() { | |||
blog.get_list(); | |||
}) | |||
if(get_url_arg("by_name")) { | |||
$("#blot-subtitle").html("Posts by " + get_url_arg("by_name")).toggle(true); | |||
} | |||
if(get_url_arg("category")) { | |||
$("#blot-subtitle").html("Posts filed under " + get_url_arg("category")).toggle(true); | |||
} | |||
}); | |||
var blog = { | |||
start: 0, | |||
get_list: function() { | |||
@@ -85,4 +67,22 @@ var blog = { | |||
$("#next-page").toggle(true); | |||
} | |||
} | |||
} | |||
}; | |||
$(document).ready(function() { | |||
// make list of blogs | |||
blog.get_list(); | |||
$("#next-page").click(function() { | |||
blog.get_list(); | |||
}) | |||
if(get_url_arg("by_name")) { | |||
$("#blot-subtitle").html("Posts by " + get_url_arg("by_name")).toggle(true); | |||
} | |||
if(get_url_arg("category")) { | |||
$("#blot-subtitle").html("Posts filed under " + get_url_arg("category")).toggle(true); | |||
} | |||
}); |
@@ -190,6 +190,7 @@ login.via_facebook = function() { | |||
} | |||
},{scope:"email"}); | |||
} | |||
{%- endif %} | |||
$(document).ready(function(wrapper) { | |||
window.location.hash = "#login"; | |||
@@ -203,5 +204,4 @@ $(document).ready(function(wrapper) { | |||
} | |||
}); | |||
$(document).trigger('login_rendered'); | |||
}) | |||
{%- endif %} | |||
}) |
@@ -5,7 +5,7 @@ | |||
<div id="the-carousel" class="carousel slide"> | |||
<!-- Indicators --> | |||
<ol class="carousel-indicators"> | |||
{% for slide in obj.slides %} | |||
{% for slide in slides %} | |||
<li data-target="#the-carousel" data-slide-to="0" | |||
{%- if loop.index==0 %}class="active"{% endif %}></li> | |||
{% endfor %} | |||
@@ -13,7 +13,7 @@ | |||
<!-- Wrapper for slides --> | |||
<div class="carousel-inner"> | |||
{% for slide in obj.slides %} | |||
{% for slide in slides %} | |||
<div class="{% if slide.idx==1 %}active {% endif %}item"> | |||
<img src="{{ slide.image | scrub_relative_url }}" class="slide-image" /> | |||
{% if slide.heading or slide.description %} | |||
@@ -12,7 +12,7 @@ def get_context(context): | |||
query_options = filter(None, bean.doc.query_options.replace(",", "\n").split()) if \ | |||
bean.doc.query_options else ["Sales", "Support", "General"] | |||
address = webnotes.bean("Address", bean.doc.address).doc if bean.doc.address else None | |||
contact_context = { | |||
@@ -23,7 +23,7 @@ def get_context(context): | |||
} | |||
contact_context.update(context) | |||
return render_blocks(context) | |||
return render_blocks(contact_context) | |||
max_communications_per_hour = 300 | |||
@@ -54,7 +54,7 @@ div.outer { | |||
{% else %} | |||
{% if doc.background_color.lower() == doc.page_background.lower() %} | |||
.web-footer { | |||
border-top: 1px solid #{{ get_hex_shade(doc.page_background, 15) }}; | |||
border-top: 1px solid #{{ doc.page_background | get_hex_shade(15) }}; | |||
padding-top: 10px; | |||
} | |||
{% endif %} | |||
@@ -62,7 +62,7 @@ div.outer { | |||
.web-footer, .web-footer a { | |||
font-size: 90%; | |||
color: #{{ get_hex_shade(doc.background_color, 70) }}; | |||
color: #{{ doc.background_color | get_hex_shade(70) }}; | |||
} | |||
/* Bootstrap Navbar */ | |||
@@ -75,7 +75,7 @@ div.outer { | |||
background-repeat: repeat-x; | |||
background-image: none; | |||
border-bottom: 1px solid {% if doc.top_bar_background.lower() == doc.page_background.lower() -%} | |||
#{{ get_hex_shade(doc.page_background, 15) }}; | |||
#{{ doc.page_background | get_hex_shade(15) }}; | |||
{%- else -%} | |||
transparent; | |||
{%- endif %} | |||
@@ -185,7 +185,7 @@ div.outer { | |||
} | |||
.breadcrumb { | |||
background-color: #{{ get_hex_shade(doc.page_background, 5) }}; | |||
background-color: #{{ doc.page_background | get_hex_shade(5) }}; | |||
} | |||
.breadcrumb > li { | |||
@@ -195,41 +195,41 @@ div.outer { | |||
.table-striped tbody > tr:nth-child(odd) > td, | |||
.table-striped tbody > tr:nth-child(odd) > th { | |||
background-color: #{{ get_hex_shade(doc.page_background, 5) }}; | |||
background-color: #{{ doc.page_background | get_hex_shade(5) }}; | |||
} | |||
.table-hover tbody tr:hover td, | |||
.table-hover tbody tr:hover th { | |||
background-color: #{{ get_hex_shade(doc.page_background, 10) }}; | |||
background-color: #{{ doc.page_background | get_hex_shade(10) }}; | |||
} | |||
.table-bordered { | |||
border: 1px solid #{{ get_hex_shade(doc.page_background, 15) }}; | |||
border: 1px solid #{{ doc.page_background | get_hex_shade(15) }}; | |||
} | |||
.table th, | |||
.table td { | |||
border-top: 1px solid #{{ get_hex_shade(doc.page_background, 15) }}; | |||
border-top: 1px solid #{{ doc.page_background | get_hex_shade(15) }}; | |||
} | |||
.table-bordered th, | |||
.table-bordered td { | |||
border-left: 1px solid #{{ get_hex_shade(doc.page_background, 15) }}; | |||
border-left: 1px solid #{{ doc.page_background | get_hex_shade(15) }}; | |||
} | |||
.hero-unit { | |||
background-color: #{{ get_hex_shade(doc.page_background, 15) }}; | |||
background-color: #{{ doc.page_background | get_hex_shade(15) }}; | |||
} | |||
pre, code { | |||
background-color: #{{ get_hex_shade(doc.page_background, 5) }}; | |||
background-color: #{{ doc.page_background | get_hex_shade(5) }}; | |||
} | |||
hr { | |||
border-top: 1px solid #{{ get_hex_shade(doc.page_background, 15) }}; | |||
border-bottom: 1px solid #{{ get_hex_shade(doc.page_background, 5) }}; | |||
border-top: 1px solid #{{ doc.page_background | get_hex_shade(15) }}; | |||
border-bottom: 1px solid #{{ doc.page_background | get_hex_shade(5) }}; | |||
} | |||
{% if doc.add_css -%} | |||
@@ -9,15 +9,10 @@ base_template_path = "templates/pages/style_settings.css" | |||
def get_context(context): | |||
"""returns web style""" | |||
from webnotes.webutils import get_hex_shade | |||
doc = webnotes.doc("Style Settings", "Style Settings") | |||
prepare(doc) | |||
return { | |||
"doc": doc, | |||
"get_hex_shade": get_hex_shade | |||
} | |||
return { "doc": doc.fields } | |||
def prepare(doc): | |||
from webnotes.utils import cint, cstr | |||
@@ -3,6 +3,11 @@ | |||
import webnotes | |||
def before_install(): | |||
webnotes.reload_doc("core", "doctype", "docfield") | |||
webnotes.reload_doc("core", "doctype", "docperm") | |||
webnotes.reload_doc("core", "doctype", "doctype") | |||
def after_install(): | |||
# reset installed apps for re-install | |||
webnotes.conn.set_global("installed_apps", '["webnotes"]') | |||
@@ -21,7 +26,10 @@ def after_install(): | |||
] | |||
for d in install_docs: | |||
webnotes.bean(d).insert() | |||
try: | |||
webnotes.bean(d).insert() | |||
except NameError: | |||
pass | |||
# all roles to admin | |||
webnotes.bean("Profile", "Administrator").get_controller().add_roles(*webnotes.conn.sql_list(""" | |||
@@ -354,18 +354,11 @@ textarea { | |||
min-width: 70px; | |||
} | |||
.hidden-xs { | |||
display: inline-block !important; | |||
} | |||
.visible-xs { | |||
display: none !important; | |||
} | |||
@media (max-width: 767px) { | |||
.hidden-xs { | |||
display: none !important; | |||
} | |||
.visible-xs { | |||
display: inline-block !important; | |||
} | |||
@@ -408,8 +401,15 @@ a.no-decoration { | |||
@media (min-width: 768px) { | |||
.page-sidebar { | |||
padding-left: 5em; | |||
} | |||
} | |||
@media (max-width: 767px) { | |||
.page-sidebar { | |||
padding-bottom: 15px; | |||
margin-bottom: 15px; | |||
border-bottom: 1px solid #eee; | |||
} | |||
} | |||
.post:last-child { | |||
@@ -2,7 +2,7 @@ | |||
{ | |||
"creation": "2013-03-28 10:35:30", | |||
"docstatus": 0, | |||
"modified": "2014-01-20 17:49:35", | |||
"modified": "2014-02-05 17:02:09", | |||
"modified_by": "Administrator", | |||
"owner": "Administrator" | |||
}, | |||
@@ -185,6 +185,13 @@ | |||
"label": "Table of Contents", | |||
"options": "Table of Contents" | |||
}, | |||
{ | |||
"doctype": "DocField", | |||
"fieldname": "parent_website_sitemap", | |||
"fieldtype": "Link", | |||
"label": "Parent Website Page", | |||
"options": "Website Sitemap" | |||
}, | |||
{ | |||
"doctype": "DocPerm" | |||
} |
@@ -2,7 +2,7 @@ | |||
{ | |||
"creation": "2014-01-29 15:57:42", | |||
"docstatus": 0, | |||
"modified": "2014-01-30 12:09:23", | |||
"modified": "2014-02-05 17:00:33", | |||
"modified_by": "Administrator", | |||
"owner": "Administrator" | |||
}, | |||
@@ -95,7 +95,7 @@ | |||
"fieldname": "parent_website_sitemap", | |||
"fieldtype": "Link", | |||
"in_list_view": 0, | |||
"label": "Parent Website Node", | |||
"label": "Parent Website Page", | |||
"options": "Website Sitemap" | |||
}, | |||
{ | |||
@@ -5,6 +5,7 @@ | |||
from __future__ import unicode_literals | |||
import webnotes | |||
from webnotes import _ | |||
from webnotes.utils.nestedset import DocTypeNestedSet | |||
sitemap_fields = ("page_name", "ref_doctype", "docname", "page_or_generator", | |||
@@ -15,7 +15,10 @@ class DocType: | |||
from webnotes.webutils import clear_cache | |||
clear_cache() | |||
def get_slideshow(obj): | |||
slideshow = webnotes.bean("Website Slideshow", obj.doc.slideshow) | |||
obj.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"}) | |||
obj.doc.slideshow_header = slideshow.doc.header or "" | |||
def get_slideshow(bean): | |||
slideshow = webnotes.bean("Website Slideshow", bean.doc.slideshow) | |||
return { | |||
"slides": slideshow.doclist.get({"doctype":"Website Slideshow Item"}), | |||
"slideshow_header": slideshow.doc.header or "" | |||
} |
@@ -404,6 +404,11 @@ $(document).ready(function() { | |||
$("#website-login").toggleClass("hide", logged_in ? true : false); | |||
$("#website-post-login").toggleClass("hide", logged_in ? false : true); | |||
$(".toggle-sidebar").on("click", function() { | |||
$(".page-sidebar").toggleClass("hidden-xs"); | |||
$(".toggle-sidebar i").toggleClass("icon-rotate-180"); | |||
}); | |||
// switch to app link | |||
if(getCookie("system_user")==="yes") { | |||
$("#website-post-login .dropdown-menu").append('<li class="divider"></li>\ | |||
@@ -31,7 +31,7 @@ def render(page_name): | |||
data = set_content_type(data, page_name) | |||
webnotes._response.data = data | |||
webnotes._response.headers["Page Name"] = page_name | |||
webnotes._response.headers[b"Page Name"] = page_name.encode("utf-8") | |||
def render_page(page_name): | |||
"""get page html""" | |||
@@ -42,11 +42,11 @@ def render_page(page_name): | |||
# try memcache | |||
if can_cache(): | |||
out = webnotes.cache().get_value(cache_key) | |||
if is_ajax(): | |||
if out and is_ajax(): | |||
out = out.get("data") | |||
if out: | |||
webnotes._response.headers["From Cache"] = True | |||
webnotes._response.headers[b"From Cache"] = True | |||
return out | |||
return build(page_name) | |||
@@ -102,13 +102,11 @@ def get_sitemap_options(page_name): | |||
if can_cache(): | |||
sitemap_options = webnotes.cache().get_value(cache_key) | |||
if sitemap_options: | |||
return sitemap_options | |||
sitemap_options = build_sitemap_options(page_name) | |||
if can_cache(sitemap_options.no_cache): | |||
webnotes.cache().set_value(cache_key, sitemap_options) | |||
if not sitemap_options: | |||
sitemap_options = build_sitemap_options(page_name) | |||
if can_cache(sitemap_options.no_cache): | |||
webnotes.cache().set_value(cache_key, sitemap_options) | |||
return sitemap_options | |||
def build_sitemap_options(page_name): | |||
@@ -138,8 +136,6 @@ def build_sitemap_options(page_name): | |||
if not sitemap_options.base_template_path: | |||
sitemap_options.base_template_path = "templates/base.html" | |||
sitemap_options.template = webnotes.get_jenv().get_template(sitemap_options.template_path) | |||
return sitemap_options | |||
def build_context(sitemap_options): | |||
@@ -152,7 +148,7 @@ def build_context(sitemap_options): | |||
module = webnotes.get_module(sitemap_options.get("controller")) | |||
if module and hasattr(module, "get_context"): | |||
context.data = module.get_context(context) or {} | |||
return context | |||
def can_cache(no_cache=False): | |||
@@ -189,8 +185,6 @@ def get_website_settings(): | |||
select * from `tabTop Bar Item` | |||
where parent='Website Settings' and parentfield='footer_items' | |||
order by idx asc""", as_dict=1), | |||
"webnotes": webnotes, | |||
"utils": webnotes.utils, | |||
"post_login": [ | |||
{"label": "Reset Password", "url": "update-password", "icon": "icon-key"}, | |||
{"label": "Logout", "url": "?cmd=web_logout", "icon": "icon-signout"} | |||
@@ -247,7 +241,7 @@ def scrub_page_name(page_name): | |||
def insert_traceback(data): | |||
traceback = webnotes.get_traceback() | |||
if isinstance(data, dict): | |||
data["error"] = traceback | |||
data["content"] = data["content"] % {"error": traceback} | |||
else: | |||
data = data % {"error": traceback} | |||
@@ -255,15 +249,15 @@ def insert_traceback(data): | |||
def set_content_type(data, page_name): | |||
if isinstance(data, dict): | |||
webnotes._response.headers["Content-Type"] = "application/json; charset: utf-8" | |||
webnotes._response.headers[b"Content-Type"] = b"application/json; charset: utf-8" | |||
data = json.dumps(data) | |||
return data | |||
webnotes._response.headers["Content-Type"] = "text/html; charset: utf-8" | |||
webnotes._response.headers[b"Content-Type"] = b"text/html; charset: utf-8" | |||
if "." in page_name and not page_name.endswith(".html"): | |||
content_type, encoding = mimetypes.guess_type(page_name) | |||
webnotes._response.headers["Content-Type"] = content_type | |||
webnotes._response.headers[b"Content-Type"] = content_type.encode("utf-8") | |||
return data | |||
@@ -417,7 +411,8 @@ def render_blocks(context): | |||
"""returns a dict of block name and its rendered content""" | |||
from jinja2.utils import concat | |||
out = {} | |||
template = context["template"] | |||
template = webnotes.get_template(context["template_path"]) | |||
# required as per low level API | |||
context = template.new_context(context) | |||