]> git.llucax.com Git - software/blitiri.git/commitdiff
Create the comments directory for an article if it doesn't exist
authorAlberto Bertogli <albertito@blitiri.com.ar>
Sat, 6 Sep 2008 14:29:30 +0000 (11:29 -0300)
committerAlberto Bertogli <albertito@blitiri.com.ar>
Sat, 6 Sep 2008 14:51:30 +0000 (11:51 -0300)
It is needed when comments are enabled after the article was added,
otherwise the save() will fail.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
blitiri.cgi

index 0c4847583a96ab5a9180655c631357a9bc8b86f0..6ada91bfb9d82ffa650188d8d5337aa37788058e 100755 (executable)
@@ -775,6 +775,11 @@ class Comment (object):
 class CommentDB (object):
        def __init__(self, article):
                self.path = os.path.join(comments_path, article.uuid)
+               # if comments were enabled after the article was added, we
+               # will need to create the directory
+               if not os.path.exists(self.path):
+                       os.mkdir(self.path, 0755)
+
                self.comments = []
                self.load(article)