Remove blog.create_paths()
This commit is contained in:
parent
152e2ab0a6
commit
aeadc248d1
|
@ -145,6 +145,8 @@ class Post(Index):
|
||||||
'replace' : self.createReplace,
|
'replace' : self.createReplace,
|
||||||
'tags' : self.createTags}
|
'tags' : self.createTags}
|
||||||
|
|
||||||
|
self.blog = blog
|
||||||
|
|
||||||
if not os.path.exists(src + '/_post.html'):
|
if not os.path.exists(src + '/_post.html'):
|
||||||
self.addError('No _post.html found, exiting')
|
self.addError('No _post.html found, exiting')
|
||||||
return self.report
|
return self.report
|
||||||
|
|
|
@ -178,8 +178,6 @@ class Category(models.Model):
|
||||||
super(Category, self).save()
|
super(Category, self).save()
|
||||||
|
|
||||||
def remove(self, blog):
|
def remove(self, blog):
|
||||||
blog.create_paths()
|
|
||||||
|
|
||||||
output = blog.output_path + '/category/' + self.name_slug
|
output = blog.output_path + '/category/' + self.name_slug
|
||||||
if os.path.exists(output):
|
if os.path.exists(output):
|
||||||
shutil.rmtree(output)
|
shutil.rmtree(output)
|
||||||
|
@ -195,8 +193,6 @@ class Tag(models.Model):
|
||||||
super(Tag, self).save()
|
super(Tag, self).save()
|
||||||
|
|
||||||
def remove(self, blog):
|
def remove(self, blog):
|
||||||
blog.create_paths()
|
|
||||||
|
|
||||||
output = blog.output_path + '/tag/' + self.name_slug
|
output = blog.output_path + '/tag/' + self.name_slug
|
||||||
if os.path.exists(output):
|
if os.path.exists(output):
|
||||||
shutil.rmtree(output)
|
shutil.rmtree(output)
|
||||||
|
@ -228,7 +224,6 @@ class Post(models.Model):
|
||||||
|
|
||||||
def createPost(self, content, tags):
|
def createPost(self, content, tags):
|
||||||
b = self.blog
|
b = self.blog
|
||||||
b.create_paths()
|
|
||||||
output = b.src_path
|
output = b.src_path
|
||||||
if not os.path.exists(output + '/_post'):
|
if not os.path.exists(output + '/_post'):
|
||||||
os.mkdir(output + '/_post')
|
os.mkdir(output + '/_post')
|
||||||
|
@ -312,7 +307,6 @@ class Post(models.Model):
|
||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
b = self.blog
|
b = self.blog
|
||||||
b.create_paths()
|
|
||||||
|
|
||||||
output = b.src_path
|
output = b.src_path
|
||||||
filename = output + '/_post/' + str(self.pk)
|
filename = output + '/_post/' + str(self.pk)
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
<div class="comment_header">#<dyn:comment_index/> De<dyn:comment_author/>, le<dyn:comment_date/></div>
|
<div class="comment_header">#<dyn:comment_index/> De<dyn:comment_author/>, le<dyn:comment_date/></div>
|
||||||
<dyn:comment_content/>
|
<dyn:comment_content/>
|
||||||
<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="http://localhost:8000/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="http://localhost:8000/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"/><br/><br/>
|
e-mail* :<br/><input type="text" name="email"/><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>
|
||||||
</dyn:comments>
|
</dyn:comments>
|
||||||
<dyn:replace div_name="form" id="response_0" method="POST" action="/comment/add/dyn:post_id/0" onsubmit="return validateComment(response_0');">
|
<dyn:replace div_name="form" id="response_0" method="POST" action="/comment/add/dyn:post_id/0" onsubmit="return validateComment('response_0');">
|
||||||
Auteur :<br/><input type="text" name="author"/><br/><br/>
|
Auteur :<br/><input type="text" name="author"/><br/><br/>
|
||||||
e-mail* :<br/><input id="email" 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/>
|
||||||
|
|
23
views.py
23
views.py
|
@ -57,6 +57,8 @@ def have_I_right(request, blog_id=None, post_id=None, must_be_superuser=False):
|
||||||
return (b, p)
|
return (b, p)
|
||||||
|
|
||||||
def createNavigationBar(blog_id, cur_page, nb_pages):
|
def createNavigationBar(blog_id, cur_page, nb_pages):
|
||||||
|
if nb_pages == 0: return ''
|
||||||
|
|
||||||
navigation_bar = ''
|
navigation_bar = ''
|
||||||
if cur_page == 0:
|
if cur_page == 0:
|
||||||
navigation_bar += '<< <'
|
navigation_bar += '<< <'
|
||||||
|
@ -438,7 +440,6 @@ def edit_post(request, post_id):
|
||||||
else:
|
else:
|
||||||
form = PostForm(instance=post, initial={'text_tags':', '.join((tag.name) for tag in post.tags.all())})
|
form = PostForm(instance=post, initial={'text_tags':', '.join((tag.name) for tag in post.tags.all())})
|
||||||
|
|
||||||
b.create_paths()
|
|
||||||
filename = b.src_path + '/_post/' + str(post.pk)
|
filename = b.src_path + '/_post/' + str(post.pk)
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
f = open(filename, 'rb')
|
f = open(filename, 'rb')
|
||||||
|
@ -496,7 +497,6 @@ def _generate(request, blog_id, report):
|
||||||
def generate(request, blog_id):
|
def generate(request, blog_id):
|
||||||
b,_ = have_I_right(request, blog_id)
|
b,_ = have_I_right(request, blog_id)
|
||||||
|
|
||||||
b.create_paths()
|
|
||||||
report = b.generate()
|
report = b.generate()
|
||||||
|
|
||||||
return _generate(request, blog_id, report)
|
return _generate(request, blog_id, report)
|
||||||
|
@ -505,8 +505,6 @@ def generate(request, blog_id):
|
||||||
def generate_search(request, blog_id):
|
def generate_search(request, blog_id):
|
||||||
b,_ = have_I_right(request, blog_id)
|
b,_ = have_I_right(request, blog_id)
|
||||||
|
|
||||||
b.create_paths()
|
|
||||||
|
|
||||||
s = Search()
|
s = Search()
|
||||||
|
|
||||||
report = s.create_index(b)
|
report = s.create_index(b)
|
||||||
|
@ -537,7 +535,6 @@ def search(request, blog_id):
|
||||||
if post_list is None: post_list = []
|
if post_list is None: post_list = []
|
||||||
|
|
||||||
s = search.Search()
|
s = search.Search()
|
||||||
b.create_paths()
|
|
||||||
|
|
||||||
res = s.generate(b, b.src_path, b.output_path, post_list)
|
res = s.generate(b, b.src_path, b.output_path, post_list)
|
||||||
|
|
||||||
|
@ -557,8 +554,6 @@ def preview(request, blog_id):
|
||||||
'content' : request.POST['content']
|
'content' : request.POST['content']
|
||||||
}
|
}
|
||||||
|
|
||||||
b.create_paths()
|
|
||||||
|
|
||||||
engine = globals()['post']
|
engine = globals()['post']
|
||||||
|
|
||||||
for name, obj in inspect.getmembers(engine):
|
for name, obj in inspect.getmembers(engine):
|
||||||
|
@ -585,8 +580,6 @@ def preview(request, blog_id):
|
||||||
def _tinymcelist(request, b, year, month):
|
def _tinymcelist(request, b, year, month):
|
||||||
ret = 'var tinyMCEImageList = new Array('
|
ret = 'var tinyMCEImageList = new Array('
|
||||||
|
|
||||||
b.create_paths()
|
|
||||||
|
|
||||||
if month < 10:
|
if month < 10:
|
||||||
suffix = '/images/' + str(year) + '/0' + str(month)
|
suffix = '/images/' + str(year) + '/0' + str(month)
|
||||||
else:
|
else:
|
||||||
|
@ -676,12 +669,16 @@ def add_comment(request, post_id, parent_id):
|
||||||
the_comment = the_comment.replace('<', '<')
|
the_comment = the_comment.replace('<', '<')
|
||||||
the_comment = the_comment.replace('>', '>')
|
the_comment = the_comment.replace('>', '>')
|
||||||
|
|
||||||
|
if 'mel' in request.POST:
|
||||||
|
mel = request.POST['mel'].strip()
|
||||||
|
else:
|
||||||
|
mel = ''
|
||||||
|
|
||||||
comment = Comment(post=post, parent=parentComment, date=datetime.now(), author=request.POST['author'].strip(),\
|
comment = Comment(post=post, parent=parentComment, date=datetime.now(), author=request.POST['author'].strip(),\
|
||||||
email=request.POST['mel'].strip(), the_comment=the_comment, ip=ip)
|
email=mel, the_comment=the_comment, ip=ip)
|
||||||
comment.save()
|
comment.save()
|
||||||
|
|
||||||
engine = globals()['post']
|
engine = globals()['post']
|
||||||
blog.create_paths()
|
|
||||||
|
|
||||||
post_list = [post]
|
post_list = [post]
|
||||||
for name, obj in inspect.getmembers(engine):
|
for name, obj in inspect.getmembers(engine):
|
||||||
|
@ -736,8 +733,8 @@ def add_comment(request, post_id, parent_id):
|
||||||
response['Expires'] = 'Thu, 01 Jan 1970 00:00:00 GMT'
|
response['Expires'] = 'Thu, 01 Jan 1970 00:00:00 GMT'
|
||||||
|
|
||||||
response.set_cookie('author', request.POST['author'], domain=blog.name, secure=True, httponly=False);
|
response.set_cookie('author', request.POST['author'], domain=blog.name, secure=True, httponly=False);
|
||||||
if request.POST['mel'] != '':
|
if mel != '':
|
||||||
response.set_cookie('email', request.POST['mel'], domain=blog.name, secure=True, httponly=False);
|
response.set_cookie('email', mel, domain=blog.name, secure=True, httponly=False);
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user