Merge branch 'master' into edge

This commit is contained in:
Anand Doshi 2013-05-22 15:52:36 +05:30
commit aed6530b08
5 changed files with 20 additions and 11 deletions

View File

@ -1,5 +1,5 @@
import webnotes, conf, os import webnotes, conf, os
from webnotes.utils import cint, cstr from webnotes.utils import cint, cstr, encode
def get_templates_path(): def get_templates_path():
return os.path.join(os.path.dirname(conf.__file__), "app", "website", "templates") return os.path.join(os.path.dirname(conf.__file__), "app", "website", "templates")
@ -72,7 +72,7 @@ def update_template_args(page_name, args):
args[k] = cint(args.get(k) or 0) args[k] = cint(args.get(k) or 0)
args.url = quote(str(get_request_site_address(full_address=True)), str("")) args.url = quote(str(get_request_site_address(full_address=True)), str(""))
args.encoded_title = quote(str(args.title or ""), str("")) args.encoded_title = quote(encode(args.title or ""), str(""))
return args return args

View File

@ -5,4 +5,9 @@ import webnotes
class DocType: class DocType:
def __init__(self, d, dl): def __init__(self, d, dl):
self.doc, self.doclist = d, dl self.doc, self.doclist = d, dl
def on_update(self):
# a slide show can be in use and any change in it should get reflected
from webnotes.webutils import clear_cache
clear_cache()

View File

@ -49,9 +49,10 @@ rss_item = u"""
def generate(): def generate():
"""generate rss feed""" """generate rss feed"""
import webnotes, os import os, urllib
import webnotes
from webnotes.model.doc import Document from webnotes.model.doc import Document
from website.helpers.blog import get_blog_content from webnotes.utils import escape_html
host = (os.environ.get('HTTPS') and 'https://' or 'http://') + os.environ.get('HTTP_HOST') host = (os.environ.get('HTTPS') and 'https://' or 'http://') + os.environ.get('HTTP_HOST')
@ -62,7 +63,8 @@ def generate():
order by published_on desc limit 20""", as_dict=1) order by published_on desc limit 20""", as_dict=1)
for blog in blog_list: for blog in blog_list:
blog.link = host + '/' + blog.name + '.html' blog.link = urllib.quote(host + '/' + blog.name + '.html')
blog.content = escape_html(blog.content or "")
items += rss_item % blog items += rss_item % blog

View File

@ -2,6 +2,7 @@
# License: GNU General Public License (v3). For more information see license.txt # License: GNU General Public License (v3). For more information see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
frame_xml = """<?xml version="1.0" encoding="UTF-8"?> frame_xml = """<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">%s <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">%s
</urlset>""" </urlset>"""
@ -32,10 +33,11 @@ def generate(domain):
for p in pages: for p in pages:
if count >= max_items: break if count >= max_items: break
page_url = os.path.join(domain, urllib.quote(p[0])) if p[0]:
modified = p[1].strftime('%Y-%m-%d') page_url = os.path.join(domain, urllib.quote(p[0]))
site_map += link_xml % (page_url, modified) modified = p[1].strftime('%Y-%m-%d')
count += 1 site_map += link_xml % (page_url, modified)
count += 1
if count >= max_items: break if count >= max_items: break

View File

@ -8,7 +8,7 @@
{% if slide.heading or slide.description %} {% if slide.heading or slide.description %}
<div class="carousel-caption"> <div class="carousel-caption">
{% if slide.heading %}<h4>{{ slide.heading }}</h4>{% endif %} {% if slide.heading %}<h4>{{ slide.heading }}</h4>{% endif %}
{% if slide.heading %}<p>{{ slide.description }}</p>{% endif %} {% if slide.description %}<p>{{ slide.description }}</p>{% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>