Add basic comments support
This patch implements the basics for comments support. Two new classes are
added: Comment and CommentDB.
Comments are stored in almost the same format as articles, but a comment DB is
present for each article. All comments are stored in the ``comments_path``
directory (which usually won't be the same as the ``data_path`` because,
when online comment posting is implemented, it will need to be writeable by
the web server). Each article should have a subdirectory in that path (with
the article's uuid as directory name), where a ``db`` file is expected, with
this format::
comment number, creation time (epoch)
Comments are numbered incrementally and this number is considered both the
ID and the filename where the comment contents are stored under the
article's comments directory. An empty line in the comments DB represents
a deleted comment.
Comment files have a similar format to Article files, a header is expected
in the form of key, values:
Author: Leandro Lucarella
Link: http://www.example.com/
Headers end with an empty line, where the body begin, in RestructuredText
format. The link can be any URL (for example, mailto:pomelo@example.com).
A new attribute ``comments`` is added to Article class, with a list of
comments for that article (loaded via the CommentDB class).
Note that a race is possible if more than one process add a comment at the
same time, because of how the CommentDB.save() method is implemented (the
same happens with ArticleDB.save(), but it's more likely that 2 comments
are added at the same, for example when online commenting is implemented).
Add a "list" view to list all articles.
Relax config import to make it usable.
The os.path.isfile("config.py") check is too strict: it makes blitiri
usable from the command line only if it's ran in the directory where it
lives.
There's no point in doing that, let's just relax the import.
The chances of a config module collision are too low to be worth the
usability problem.
Signed-off-by: Alberto Bertogli <albertito@gmail.com>
Be more verbose with article path errors.
It's easier to debug problems if we echo the full paths when dying because
the article is not inside the data path.
Signed-off-by: Alberto Bertogli <albertito@gmail.com>
Add coding:utf8 to the sample config file.
If somebody edits and uses a non-ascii character, importing it will
fail and blitiri will just ignore it, which is not easier to debug.
Signed-off-by: Alberto Bertogli <albertito@gmail.com>
Initial commit.
Signed-off-by: Alberto Bertogli <albertito@gmail.com>