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:
parent
8d02850017
commit
0150b9f6cd
|
@ -44,11 +44,13 @@ class Atom(RSS):
|
||||||
modificationDate = post.modification_date.strftime('%Y-%m-%dT%H:%M:%SZ')
|
modificationDate = post.modification_date.strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||||
self.appendElement(dom, item, 'updated', modificationDate)
|
self.appendElement(dom, item, 'updated', modificationDate)
|
||||||
self.appendElement(dom, item, 'id', path)
|
self.appendElement(dom, item, 'id', path)
|
||||||
|
try:
|
||||||
author = dom.createElement('author')
|
author = dom.createElement('author')
|
||||||
self.appendElement(dom, author, 'name', post.author.first_name + ' ' + post.author.last_name)
|
self.appendElement(dom, author, 'name', post.author.first_name + ' ' + post.author.last_name)
|
||||||
self.appendElement(dom, author, 'email', post.author.email)
|
self.appendElement(dom, author, 'email', post.author.email)
|
||||||
item.appendChild(author)
|
item.appendChild(author)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
filename = blog.src_path + '/_post/' + str(post.id)
|
filename = blog.src_path + '/_post/' + str(post.id)
|
||||||
|
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
|
|
|
@ -125,7 +125,10 @@ class Index(DynastieGenerator):
|
||||||
return node.cloneNode(0)
|
return node.cloneNode(0)
|
||||||
|
|
||||||
values = {}
|
values = {}
|
||||||
|
try:
|
||||||
values['author'] = post.author.first_name + ' ' + post.author.last_name
|
values['author'] = post.author.first_name + ' ' + post.author.last_name
|
||||||
|
except:
|
||||||
|
values['author'] = 'Unknown'
|
||||||
values['post_content'] = ''
|
values['post_content'] = ''
|
||||||
|
|
||||||
blog = post.blog
|
blog = post.blog
|
||||||
|
|
|
@ -108,7 +108,10 @@ class Post(Index):
|
||||||
elif name == 'description':
|
elif name == 'description':
|
||||||
new_elem = self.createMeta(dom, name, post.description)
|
new_elem = self.createMeta(dom, name, post.description)
|
||||||
elif name == 'author':
|
elif name == 'author':
|
||||||
|
try:
|
||||||
new_elem = self.createMeta(dom, name, post.author.first_name + ' ' + post.author.last_name)
|
new_elem = self.createMeta(dom, name, post.author.first_name + ' ' + post.author.last_name)
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
if not new_elem is None:
|
if not new_elem is None:
|
||||||
root.parentNode.replaceChild(new_elem, root)
|
root.parentNode.replaceChild(new_elem, root)
|
||||||
|
|
|
@ -61,10 +61,13 @@ class RSS(DynastieGenerator):
|
||||||
|
|
||||||
self.appendElement(dom, item, 'description', '<![CDATA[' + post_content + ']]>')
|
self.appendElement(dom, item, 'description', '<![CDATA[' + post_content + ']]>')
|
||||||
|
|
||||||
|
try:
|
||||||
author = post.author.email
|
author = post.author.email
|
||||||
author += ' (' + post.author.first_name + ' ' + post.author.last_name + ')'
|
author += ' (' + post.author.first_name + ' ' + post.author.last_name + ')'
|
||||||
self.appendElement(dom, item, 'author', author)
|
self.appendElement(dom, item, 'author', author)
|
||||||
self.appendElement(dom, item, 'category', post.category.name)
|
self.appendElement(dom, item, 'category', post.category.name)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
creationDate = post.creation_date.strftime('%a, %d %b %Y %H:%M:%S')
|
creationDate = post.creation_date.strftime('%a, %d %b %Y %H:%M:%S')
|
||||||
self.appendElement(dom, item, 'pubDate', creationDate)
|
self.appendElement(dom, item, 'pubDate', creationDate)
|
||||||
|
|
|
@ -362,3 +362,8 @@ def delete_tag_signal(sender, **kwargs):
|
||||||
@receiver(post_delete, sender=Post)
|
@receiver(post_delete, sender=Post)
|
||||||
def delete_post_signal(sender, **kwargs):
|
def delete_post_signal(sender, **kwargs):
|
||||||
kwargs['instance'].remove()
|
kwargs['instance'].remove()
|
||||||
|
|
||||||
|
@receiver(pre_delete, sender=Post)
|
||||||
|
def pre_delete_post_signal(sender, **kwargs):
|
||||||
|
post = kwargs['instance']
|
||||||
|
comments = Comment.objects.filter(post=post.id).delete()
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<dyn:replace div_name="a" href="javascript:void(0);" onClick="javascript:display('response_dyn:comment_index');">Répondre</dyn:replace><br/>
|
<dyn:replace div_name="a" href="javascript:void(0);" onClick="javascript:display('response_dyn:comment_index');">Répondre</dyn:replace><br/>
|
||||||
<dyn:replace div_name="form" id="response_dyn:comment_index" class="response" method="POST" action="/comment/add/dyn:post_id/dyn:comment_id" onsubmit="return validateComment('response_dyn:comment_index');">
|
<dyn:replace div_name="form" id="response_dyn:comment_index" class="response" method="POST" action="/comment/add/dyn:post_id/dyn:comment_id" onsubmit="return validateComment('response_dyn:comment_index');">
|
||||||
Auteur :<br/><input type="text" name="author"/><br/><br/>
|
Auteur :<br/><input type="text" name="author"/><br/><br/>
|
||||||
e-mail* :<br/><input type="text" name="email"/><input type="text" name="mel"/><br/><br/>
|
e-mail* :<br/><input id="email" type="text" name="email"/><input type="text" name="mel"/><br/><br/>
|
||||||
Le commentaire :<br/><textarea name="the_comment" cols="80" rows="10"> </textarea><br/><br/>
|
Le commentaire :<br/><textarea name="the_comment" cols="80" rows="10"> </textarea><br/><br/>
|
||||||
<input type="submit" value="Commenter"/>
|
<input type="submit" value="Commenter"/>
|
||||||
</dyn:replace>
|
</dyn:replace>
|
||||||
|
|
6
views.py
6
views.py
|
@ -577,7 +577,7 @@ def preview(request, blog_id):
|
||||||
c = {'content' : content}
|
c = {'content' : content}
|
||||||
|
|
||||||
return HttpResponseRedirect('http://' + b.name + '/preview.html')
|
return HttpResponseRedirect('http://' + b.name + '/preview.html')
|
||||||
# return HttpResponseRedirect('http://' + 'localhost:8080' + '/preview.html')
|
# return HttpResponseRedirect('http://' + 'localhost:8080' + '/preview.html')
|
||||||
|
|
||||||
def _tinymcelist(request, b, year, month):
|
def _tinymcelist(request, b, year, month):
|
||||||
ret = 'var tinyMCEImageList = new Array('
|
ret = 'var tinyMCEImageList = new Array('
|
||||||
|
@ -683,10 +683,12 @@ def add_comment(request, post_id, parent_id):
|
||||||
engine = globals()['post']
|
engine = globals()['post']
|
||||||
|
|
||||||
post_list = [post]
|
post_list = [post]
|
||||||
|
hash_post = {}
|
||||||
|
hash_post_content = {}
|
||||||
for name, obj in inspect.getmembers(engine):
|
for name, obj in inspect.getmembers(engine):
|
||||||
if inspect.isclass(obj) and obj.__module__.startswith("dynastie.generators") \
|
if inspect.isclass(obj) and obj.__module__.startswith("dynastie.generators") \
|
||||||
and obj.__module__.endswith("post"):
|
and obj.__module__.endswith("post"):
|
||||||
e = obj()
|
e = obj(hash_post, hash_post_content)
|
||||||
content = e._generate(blog, blog.src_path, blog.output_path, post_list)
|
content = e._generate(blog, blog.src_path, blog.output_path, post_list)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user