diff --git a/models.py b/models.py index f9fd248..3c6317b 100644 --- a/models.py +++ b/models.py @@ -225,7 +225,8 @@ class Post(models.Model): if os.path.exists(filename): os.unlink(filename) f = open(filename, 'wb') - f.write(content) + content = unicode(content) + f.write(content.encode('utf-8')) f.close() def remove(self): @@ -244,14 +245,14 @@ class Post(models.Model): if os.path.exists(filename): os.unlink(filename) - filename = b.output_path + '/post/' + filename = b.src_path + '/post/' filename = filename + self.creation_date.strftime("%Y") + '/' + self.creation_date.strftime("%m") + '/' - if len(os.listdir(filename)) == 0: + if os.path.exists(filename) and len(os.listdir(filename)) == 0: os.rmdir(filename) filename = b.output_path + '/post/' filename = filename + self.creation_date.strftime("%Y") + '/' - if len(os.listdir(filename)) == 0: + if os.path.exists(filename) and len(os.listdir(filename)) == 0: os.rmdir(filename) class Comment(models.Model): diff --git a/templates/add_post.html b/templates/add_post.html index 600f0b1..2e036fe 100644 --- a/templates/add_post.html +++ b/templates/add_post.html @@ -9,7 +9,9 @@ tinyMCE.init({ theme : "advanced", plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", editor_selector : "mceAdvanced", - +encoding : "raw", +entities : "", +entity_encoding : "raw", // Theme options theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", diff --git a/templates/generate.html b/templates/generate.html index 0927dd2..8fc683d 100644 --- a/templates/generate.html +++ b/templates/generate.html @@ -24,7 +24,7 @@ {% else %} {% for post in posts %} - + {% endfor %} {% endif %}
{{ post.id }}{{ post.title }}{{ post.category.name }}{{ post.creation_date }}{{ post.published }}{{ post.front_page }}Delete
{{ post.id }}{{ post.title }}{{ post.category.name }}{{ post.creation_date }}{{ post.modification_date }}{{ post.published }}{{ post.front_page }}Delete