diff options
| author | Georg Brandl <georg@python.org> | 2010-11-21 13:41:19 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-11-21 13:41:19 +0100 |
| commit | 53d237a4eb609aa330e25b7d8ebbacdfd5eb26db (patch) | |
| tree | 48795e07d564faeffcde53be802043ce644bbc71 /sphinx/websupport | |
| parent | bdf27419e46bc005de470207fdecd4a07a1c8e57 (diff) | |
| download | sphinx-git-53d237a4eb609aa330e25b7d8ebbacdfd5eb26db.tar.gz | |
Allow configuration whether to allow anonymous comments.
Diffstat (limited to 'sphinx/websupport')
| -rw-r--r-- | sphinx/websupport/__init__.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sphinx/websupport/__init__.py b/sphinx/websupport/__init__.py index d483a1ff8..35696c22c 100644 --- a/sphinx/websupport/__init__.py +++ b/sphinx/websupport/__init__.py @@ -42,6 +42,7 @@ class WebSupport(object): status=sys.stdout, warning=sys.stderr, moderation_callback=None, + allow_anonymous_comments=True, docroot='', staticroot='static', ): @@ -59,6 +60,7 @@ class WebSupport(object): self.status = status self.warning = warning self.moderation_callback = moderation_callback + self.allow_anonymous_comments = allow_anonymous_comments self._init_templating() self._init_search(search) @@ -314,6 +316,11 @@ class WebSupport(object): :param username: the username of the user making the comment. :param time: the time the comment was created, defaults to now. """ + if username is None: + if self.allow_anonymous_comments: + username = 'Anonymous' + else: + raise errors.UserNotAuthorizedError() text = self._parse_comment_text(text) comment = self.storage.add_comment(text, displayed, username, time, proposal, node_id, |
