Add verifications during blog generation when user/category is suppressed

Delete comments when a post is deleted
Forgot to set email input as hidden in comment responses
Forgot to setup cache for post comment generation
This commit is contained in:
2013-01-29 18:51:23 +01:00
parent 8d02850017
commit 0150b9f6cd
7 changed files with 40 additions and 22 deletions

View File

@@ -44,11 +44,13 @@ class Atom(RSS):
modificationDate = post.modification_date.strftime('%Y-%m-%dT%H:%M:%SZ')
self.appendElement(dom, item, 'updated', modificationDate)
self.appendElement(dom, item, 'id', path)
author = dom.createElement('author')
self.appendElement(dom, author, 'name', post.author.first_name + ' ' + post.author.last_name)
self.appendElement(dom, author, 'email', post.author.email)
item.appendChild(author)
try:
author = dom.createElement('author')
self.appendElement(dom, author, 'name', post.author.first_name + ' ' + post.author.last_name)
self.appendElement(dom, author, 'email', post.author.email)
item.appendChild(author)
except:
pass
filename = blog.src_path + '/_post/' + str(post.id)
if not os.path.exists(filename):

View File

@@ -125,7 +125,10 @@ class Index(DynastieGenerator):
return node.cloneNode(0)
values = {}
values['author'] = post.author.first_name + ' ' + post.author.last_name
try:
values['author'] = post.author.first_name + ' ' + post.author.last_name
except:
values['author'] = 'Unknown'
values['post_content'] = ''
blog = post.blog

View File

@@ -108,7 +108,10 @@ class Post(Index):
elif name == 'description':
new_elem = self.createMeta(dom, name, post.description)
elif name == 'author':
new_elem = self.createMeta(dom, name, post.author.first_name + ' ' + post.author.last_name)
try:
new_elem = self.createMeta(dom, name, post.author.first_name + ' ' + post.author.last_name)
except:
return None
if not new_elem is None:
root.parentNode.replaceChild(new_elem, root)

View File

@@ -61,10 +61,13 @@ class RSS(DynastieGenerator):
self.appendElement(dom, item, 'description', '<![CDATA[' + post_content + ']]>')
author = post.author.email
author += ' (' + post.author.first_name + ' ' + post.author.last_name + ')'
self.appendElement(dom, item, 'author', author)
self.appendElement(dom, item, 'category', post.category.name)
try:
author = post.author.email
author += ' (' + post.author.first_name + ' ' + post.author.last_name + ')'
self.appendElement(dom, item, 'author', author)
self.appendElement(dom, item, 'category', post.category.name)
except:
pass
creationDate = post.creation_date.strftime('%a, %d %b %Y %H:%M:%S')
self.appendElement(dom, item, 'pubDate', creationDate)