updates in feed generation
This commit is contained in:
parent
e965f7f524
commit
e83f54eadb
5 changed files with 22 additions and 47 deletions
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-04-02 16:01:07',
|
||||
'creation': '2012-05-10 13:55:07',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-05-07 12:17:01',
|
||||
'modified': '2012-07-12 11:37:24',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
|
@ -99,15 +99,6 @@
|
|||
'label': u'Title'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'web_page',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Web Page',
|
||||
'options': u'No\nYes'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
|
|
|
|||
|
|
@ -1,11 +1,3 @@
|
|||
|
||||
def page_name(title):
|
||||
"""truncated page name"""
|
||||
import re
|
||||
name = title.lower()
|
||||
name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
|
||||
return '-'.join(name.split()[:4])
|
||||
|
||||
def get_home_page(user=None):
|
||||
"""get home page for user"""
|
||||
if not user:
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
<meta name="generator" content="wnframework">
|
||||
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
|
||||
<script type="text/javascript" src="js/lib/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/all-web.js"></script>
|
||||
<script type="text/javascript" src="js/wn-web.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="css/all-web.css">
|
||||
<link type="text/css" rel="stylesheet" href="css/wn-web.css">
|
||||
|
||||
{% block header %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
|
|
@ -50,15 +50,13 @@ def generate():
|
|||
"""generate rss feed"""
|
||||
import webnotes, os
|
||||
from webnotes.model.doc import Document
|
||||
import webnotes.utils
|
||||
|
||||
host = (os.environ.get('HTTPS') and 'https://' or 'http://') + os.environ.get('HTTP_HOST')
|
||||
|
||||
items = ''
|
||||
blog_list = webnotes.conn.sql("""\
|
||||
select
|
||||
cache.name as name, cache.html as content,
|
||||
cache.modified as modified,
|
||||
cache.name as name, cache.modified as modified,
|
||||
blog.creation as published, blog.title as title
|
||||
from `tabWeb Cache` cache, `tabBlog` blog
|
||||
where cache.doc_type = 'Blog' and blog.page_name = cache.name
|
||||
|
|
@ -66,7 +64,9 @@ def generate():
|
|||
|
||||
for blog in blog_list:
|
||||
blog['link'] = host + '/' + blog['name'] + '.html'
|
||||
blog['content'] = webnotes.utils.escape_html((blog.get('content') or ''))
|
||||
|
||||
blog['content'] = get_content(blog['name'])
|
||||
|
||||
items += rss_item % blog
|
||||
|
||||
modified = max((blog['modified'] for blog in blog_list))
|
||||
|
|
@ -78,4 +78,19 @@ def generate():
|
|||
'modified': modified,
|
||||
'items': items,
|
||||
'link': host + '/blog.html'
|
||||
}).encode('utf-8', 'ignore')
|
||||
}).encode('utf-8', 'ignore')
|
||||
|
||||
def get_content(page_name):
|
||||
import website.web_cache
|
||||
content = website.web_cache.get_html(page_name)
|
||||
|
||||
import webnotes.utils
|
||||
|
||||
content = content.split("<!-- begin blog content -->")
|
||||
content = len(content) > 1 and content[1] or content[0]
|
||||
|
||||
content = content.split("<!-- end blog content -->")
|
||||
content = content[0]
|
||||
|
||||
content = webnotes.utils.escape_html(content)
|
||||
return content
|
||||
|
|
@ -21,7 +21,6 @@ def make_web_core():
|
|||
import webnotes
|
||||
|
||||
home_page = webnotes.cms.get_home_page('Guest')
|
||||
#get_obj('Page', home_page).write_cms_page()
|
||||
|
||||
# js/wn-web.js and css/wn-web.css
|
||||
write_web_js_css(home_page)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue