Prepare files for API documentation.

This commit is contained in:
Timo Stollenwerk 2012-01-25 17:12:13 +01:00
parent 4d12aa4df2
commit 7d34baf2d5
6 changed files with 73 additions and 63 deletions

View File

@ -7,19 +7,11 @@ The conversation is responsible for storing all comments. It provides a
dict-like API for accessing comments, where keys are integers and values dict-like API for accessing comments, where keys are integers and values
are IComment objects. It also provides features for finding comments quickly. are IComment objects. It also provides features for finding comments quickly.
The IReplies adapter provides an API for finding and manipulating the comments The IReplies adapter provides an API for finding and manipulating the comments
directly in reply to a particular comment (implemented by the CommentReplies directly in reply to a particular comment (implemented by the CommentReplies
adpater) or at the top level of the conversation (implemented by the adpater) or at the top level of the conversation (implemented by the
ConversationReplies adapter). ConversationReplies adapter).
.. autointerface:: plone.app.discussion.interfaces.IConversation .. include:: ../../plone/app/discussion/conversation.txt
:members:
.. autointerface:: plone.app.discussion.interfaces.IReplies .. include:: ../../plone/app/discussion/comment.txt
:members:
.. autointerface:: plone.app.discussion.interfaces.IComment
:members:

View File

@ -22,13 +22,13 @@ import sys, os
# Add any Sphinx extension module names here, as strings. They can be extensions # Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', extensions = ['sphinx.ext.autodoc',
'sphinx.ext.doctest', 'sphinx.ext.doctest',
'sphinx.ext.intersphinx', 'sphinx.ext.intersphinx',
'sphinx.ext.todo', 'sphinx.ext.todo',
'sphinx.ext.coverage', 'sphinx.ext.coverage',
'repoze.sphinx.autointerface',] 'repoze.sphinx.autointerface',]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']

View File

@ -8,25 +8,25 @@ This document describes the plone.app.discussion email notification feature.
Introduction Introduction
============ ============
plone.app.discussion allows users and administrators to be notified about new plone.app.discussion allows users and administrators to be notified about new
comments by email. There are two kinds of email notification: comments by email. There are two kinds of email notification:
1) **User notification**: Tell users when a comment has been added. 1) **User notification**: Tell users when a comment has been added.
This method composes and sends emails to all users that have added a comment This method composes and sends emails to all users that have added a comment
to this conversation and enabled user notification. to this conversation and enabled user notification.
This requires the user_notification setting to be enabled in the discussion This requires the user_notification setting to be enabled in the discussion
control panel. control panel.
2) **Moderator notification**: Tell the moderator when a comment needs attention. 2) **Moderator notification**: Tell the moderator when a comment needs attention.
This method sends an email to the site admin (mail control panel setting) if This method sends an email to the site admin (mail control panel setting) if
comment moderation is enabled and a new comment has been added that needs to comment moderation is enabled and a new comment has been added that needs to
be approved. be approved.
This requires the moderator_notification to be enabled in the discussion This requires the moderator_notification to be enabled in the discussion
control panel and the comment_review_workflow enabled for the comment content control panel and the comment_review_workflow enabled for the comment content
type. type.
@ -60,16 +60,16 @@ Moderator Notification
Event Subscribers Event Subscribers
================= =================
Email notifications are triggered by event subscribers that are called when a Email notifications are triggered by event subscribers that are called when a
comment has been added to a page. comment has been added to a page.
.. note:: .. note::
In Plone 3, the event subscribers were located in the zope.lifecycleevent In Plone 3, the event subscribers were located in the zope.lifecycleevent
package. They moved to zope.app.container in Plone 4. Therefore package. They moved to zope.app.container in Plone 4. Therefore
plone.app.discussion registers one of the two subscribers, dependent on the plone.app.discussion registers one of the two subscribers, dependent on the
Plone version. Plone version.
To create custom email notifications, register a new event subscriber or To create custom email notifications, register a new event subscriber or
override an existing one. override an existing one.
*plone/app/discussion/notifications.zcml* *plone/app/discussion/notifications.zcml*

View File

@ -2,14 +2,14 @@
Permissions and Workflows Permissions and Workflows
========================= =========================
This document describes how plone.app.discussion handles permissions and This document describes how plone.app.discussion handles permissions and
workflows. workflows.
Introduction Introduction
============ ============
plone.app.discussion uses permissions and workflows to control what a user is plone.app.discussion uses permissions and workflows to control what a user is
allowed to do. It tries to use the default Plone permissions and workflow allowed to do. It tries to use the default Plone permissions and workflow
engine as much as possible. engine as much as possible.
@ -17,77 +17,77 @@ engine as much as possible.
Permissions Permissions
=========== ===========
plone.app.discussion knows two permissions to control what a user is allowed to plone.app.discussion knows two permissions to control what a user is allowed to
do. The 'Reply to item' permission to control who is allowed to post a comment do. The 'Reply to item' permission to control who is allowed to post a comment
on a content object and the 'Review comments' permission to control who is on a content object and the 'Review comments' permission to control who is
allowed to review comments. allowed to review comments.
1) **Permission to post a comment**: 1) **Permission to post a comment**:
The permission to post a comment is controlled by the 'Reply to item' The permission to post a comment is controlled by the 'Reply to item'
permission. By default, this permission is granted to the 'Member', permission. By default, this permission is granted to the 'Member',
'Reviewer', and 'Manager' role. 'Reviewer', and 'Manager' role.
2) **Permission to review comments**: 2) **Permission to review comments**:
The permission to review comments is controlled by the 'Review comments' The permission to review comments is controlled by the 'Review comments'
permission. By default, this permission is granted to the 'Reviewer' and permission. By default, this permission is granted to the 'Reviewer' and
'Manager' role. 'Manager' role.
Changing permissions Changing permissions
-------------------- --------------------
If you want to change the way plone.app.discussion allows users to post or If you want to change the way plone.app.discussion allows users to post or
review comments you can do that by changing which permissions are granted to review comments you can do that by changing which permissions are granted to
which rules. In Plone permissions are always granted to roles, not to users which rules. In Plone permissions are always granted to roles, not to users
directly. directly.
For instance, if you want to allow users without the 'Member' role to post For instance, if you want to allow users without the 'Member' role to post
comments, you have to grant the 'Reply to item' permission to the comments, you have to grant the 'Reply to item' permission to the
'Authenticated' role. 'Authenticated' role.
Or, if you don't want to allow 'Reviewers' to review comments anymore, you Or, if you don't want to allow 'Reviewers' to review comments anymore, you
can just remove the 'Review comments' permission from the 'Reviewer' role. can just remove the 'Review comments' permission from the 'Reviewer' role.
.. note:: For a general introduction to permissions and roles in Plone see: .. note:: For a general introduction to permissions and roles in Plone see:
http://plone.org/documentation/kb/understanding-permissions/permissions-and-roles http://plone.org/documentation/kb/understanding-permissions/permissions-and-roles
http://plone.org/products/dexterity/documentation/manual/developer-manual/advanced/permissions http://plone.org/products/dexterity/documentation/manual/developer-manual/advanced/permissions
Workflows Workflows
========= =========
plone.app.discussion ships with a simple one-state plone.app.discussion ships with a simple one-state
workflow and a review workflow for comments: workflow and a review workflow for comments:
1) **Comment Single State Workflow**: 1) **Comment Single State Workflow**:
Essentially a workflow with no transitions, but it has a published state, Essentially a workflow with no transitions, but it has a published state,
so portlets and applications that expect that state will continue to work. so portlets and applications that expect that state will continue to work.
2) **Comment Review Workflow**: A simple review workflow for comments 2) **Comment Review Workflow**: A simple review workflow for comments
A simple review workflow that comes with two states (pending and published) A simple review workflow that comes with two states (pending and published)
and a single transition (publish). and a single transition (publish).
The 'pending' state is the initial state. 'published' is the state where the The 'pending' state is the initial state. 'published' is the state where the
comment is visible to everyone and non-editable. comment is visible to everyone and non-editable.
The 'publish' transition is protected by the 'Review comments' permission. The 'publish' transition is protected by the 'Review comments' permission.
:: ::
* --> [pending] -- {publish} --> [published]--> * * --> [pending] -- {publish} --> [published]--> *
.. note:: For a general introduction to workflows in Plone see: .. note:: For a general introduction to workflows in Plone see:
http://plone.org/documentation/kb/creating-workflows-in-plone/ http://plone.org/documentation/kb/creating-workflows-in-plone/
Custom comment workflow Custom comment workflow
----------------------- -----------------------
You can create and enable any custom workflow on the "comment" content type. You can create and enable any custom workflow on the "comment" content type.
Though, there are some special hooks in plone.app.discussion that check if the Though, there are some special hooks in plone.app.discussion that check if the
workflow that is enabled for the "comment" content type has a 'pending' state in workflow that is enabled for the "comment" content type has a 'pending' state in
order to do the following things: order to do the following things:
@ -95,12 +95,12 @@ order to do the following things:
1) A portal message will be shown to the user after posting a comment, if 1) A portal message will be shown to the user after posting a comment, if
the comment just entered the 'pending' state. the comment just entered the 'pending' state.
2) A message is shown to the user if he/she accesses the bulk moderation view 2) A message is shown to the user if he/she accesses the bulk moderation view
and workflow is enabled for comments that does not implement a 'pending' and workflow is enabled for comments that does not implement a 'pending'
state. state.
3) A moderator will only be emailed when comment moderation is enabled in the 3) A moderator will only be emailed when comment moderation is enabled in the
discussion control panel and the comment workflow contains a 'pending' discussion control panel and the comment workflow contains a 'pending'
state. state.

View File

@ -0,0 +1,10 @@
Comment
=======
.. literalinclude:: ../../plone/app/discussion/interfaces.py
:language: python
:pyobject: IComment
.. autointerface:: plone.app.discussion.interfaces.IComment
:members:

View File

@ -0,0 +1,8 @@
Conversation
============
.. autointerface:: plone.app.discussion.interfaces.IConversation
:members:
.. autointerface:: plone.app.discussion.interfaces.IReplies
:members: