From 74a71431203c30c3b47ca985ec3d08e1ac38b080 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sat, 6 Sep 2008 11:29:30 -0300 Subject: [PATCH] Create the comments directory for an article if it doesn't exist It is needed when comments are enabled after the article was added, otherwise the save() will fail. Signed-off-by: Alberto Bertogli --- blitiri.cgi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/blitiri.cgi b/blitiri.cgi index 0c48475..6ada91b 100755 --- a/blitiri.cgi +++ b/blitiri.cgi @@ -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) -- 2.43.0