Whitespace
This commit is contained in:
parent
e64d23bef7
commit
80d70bbf08
@ -8,29 +8,29 @@ architecture.
|
|||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
|
||||||
When a Captcha plugin (e.g. plone.formwidget.captcha or
|
When a Captcha plugin (e.g. plone.formwidget.captcha or
|
||||||
plone.formwidget.recaptcha) is installed, plone.app.discussion extends the
|
plone.formwidget.recaptcha) is installed, plone.app.discussion extends the
|
||||||
comment form with a Captcha field/widget and a Captcha validator.
|
comment form with a Captcha field/widget and a Captcha validator.
|
||||||
|
|
||||||
The form extender and validator are only registered if there is a plugin
|
The form extender and validator are only registered if there is a plugin
|
||||||
installed that claims to provide the "plone.app.discussion-captcha" feature in
|
installed that claims to provide the "plone.app.discussion-captcha" feature in
|
||||||
its configure.zcml file::
|
its configure.zcml file::
|
||||||
|
|
||||||
<configure
|
<configure
|
||||||
xmlns:meta="http://namespaces.zope.org/meta"
|
xmlns:meta="http://namespaces.zope.org/meta"
|
||||||
xmlns:zcml="http://namespaces.zope.org/zcml">
|
xmlns:zcml="http://namespaces.zope.org/zcml">
|
||||||
|
|
||||||
<!-- Declare that plone.formwidget.captcha provides a Captcha field that
|
<!-- Declare that plone.formwidget.captcha provides a Captcha field that
|
||||||
can be used by plone.app.discussion to add a Captcha field to comment
|
can be used by plone.app.discussion to add a Captcha field to comment
|
||||||
forms. -->
|
forms. -->
|
||||||
<meta:provides feature="plone.app.discussion-captcha" />
|
<meta:provides feature="plone.app.discussion-captcha" />
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Currently plone.formwidget.captcha and plone.formwidget.recaptcha claim to
|
Currently plone.formwidget.captcha and plone.formwidget.recaptcha claim to
|
||||||
provide such a feature. If you want to write your own Captcha plugin, it has
|
provide such a feature. If you want to write your own Captcha plugin, it has
|
||||||
to provide this feature as well.
|
to provide this feature as well.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
@ -38,13 +38,13 @@ its configure.zcml file::
|
|||||||
* https://svn.plone.org/svn/plone/plone.formwidget.captcha/trunk/plone/formwidget/captcha/meta.zcml
|
* https://svn.plone.org/svn/plone/plone.formwidget.captcha/trunk/plone/formwidget/captcha/meta.zcml
|
||||||
* https://svn.plone.org/svn/plone/plone.formwidget.recaptcha/trunk/plone/formwidget/recaptcha/meta.zcml
|
* https://svn.plone.org/svn/plone/plone.formwidget.recaptcha/trunk/plone/formwidget/recaptcha/meta.zcml
|
||||||
|
|
||||||
|
|
||||||
CaptchaExtender
|
CaptchaExtender
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
The CaptchaExtender class extends the comment form with a Captcha field and
|
The CaptchaExtender class extends the comment form with a Captcha field and
|
||||||
widget. The CaptchaExtender currently uses either the CaptchaFieldWidget from
|
widget. The CaptchaExtender currently uses either the CaptchaFieldWidget from
|
||||||
plone.formwidget.captcha or the ReCaptchaFieldWidget from
|
plone.formwidget.captcha or the ReCaptchaFieldWidget from
|
||||||
plone.formwidget.recaptcha. If you want to write your own Captcha solution, you
|
plone.formwidget.recaptcha. If you want to write your own Captcha solution, you
|
||||||
have to override the update() method of the CaptchaExtender or write your own
|
have to override the update() method of the CaptchaExtender or write your own
|
||||||
CaptchaExtender class.
|
CaptchaExtender class.
|
||||||
@ -57,23 +57,23 @@ CaptchaExtender class.
|
|||||||
CaptchaValidator
|
CaptchaValidator
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
The CaptchaValidator class provides custom versions of the
|
The CaptchaValidator class provides custom versions of the
|
||||||
plone.formwidget.captcha and the plone.formwidget.recaptcha validators. It does
|
plone.formwidget.captcha and the plone.formwidget.recaptcha validators. It does
|
||||||
this, because we want to be able to have more than one Captcha solution
|
this, because we want to be able to have more than one Captcha solution
|
||||||
installed in one Plone instance. We also want to be able to easily switch
|
installed in one Plone instance. We also want to be able to easily switch
|
||||||
between different Captcha implementations inside a single Plone instance.
|
between different Captcha implementations inside a single Plone instance.
|
||||||
|
|
||||||
Therefore we have to check which Captcha solution is enabled in the discussion
|
Therefore we have to check which Captcha solution is enabled in the discussion
|
||||||
control panel and use only the selected Captcha validator. It is not enough to
|
control panel and use only the selected Captcha validator. It is not enough to
|
||||||
check if a Captcha plugin is just installed, because there could be more than
|
check if a Captcha plugin is just installed, because there could be more than
|
||||||
one.
|
one.
|
||||||
|
|
||||||
We do two checks. First we check for a suitable Captcha solution (check for the
|
We do two checks. First we check for a suitable Captcha solution (check for the
|
||||||
plone.app.discussion-captcha feature, see notes above). Second, we check which
|
plone.app.discussion-captcha feature, see notes above). Second, we check which
|
||||||
Captcha solution is enabled in the discussion control panel and apply the
|
Captcha solution is enabled in the discussion control panel and apply the
|
||||||
corresponding field validator.
|
corresponding field validator.
|
||||||
|
|
||||||
The plone.app.discussion captcha validator always checks for a view with the
|
The plone.app.discussion captcha validator always checks for a view with the
|
||||||
name of the captcha plugin. For instance, if plone.formwidget.captcha is enabled
|
name of the captcha plugin. For instance, if plone.formwidget.captcha is enabled
|
||||||
it checks for a "captcha" view.
|
it checks for a "captcha" view.
|
||||||
|
|
||||||
@ -85,13 +85,13 @@ it checks for a "captcha" view.
|
|||||||
.. Writing your own Captcha plugin
|
.. Writing your own Captcha plugin
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
If you want to write your own Captcha plugin, you have to add at least the
|
If you want to write your own Captcha plugin, you have to add at least the
|
||||||
following things:
|
following things:
|
||||||
|
|
||||||
1) Add your Captcha plugin to the captcha_vocabulary (vocabularies.py)
|
1) Add your Captcha plugin to the captcha_vocabulary (vocabularies.py)
|
||||||
|
|
||||||
2) Override the update() method of the CapchaExtender class (browser/captcha.py)
|
2) Override the update() method of the CapchaExtender class (browser/captcha.py)
|
||||||
to show your own Captcha widget.
|
to show your own Captcha widget.
|
||||||
|
|
||||||
3) Override the validate() method of the CaptchaValidator class
|
3) Override the validate() method of the CaptchaValidator class
|
||||||
(browser/validator.py) to use your own Captcha validator.
|
(browser/validator.py) to use your own Captcha validator.
|
||||||
|
@ -126,14 +126,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</tal:getreplies>
|
</tal:getreplies>
|
||||||
|
|
||||||
<div tal:condition="python: has_replies and not isDiscussionAllowed"
|
<div tal:condition="python: has_replies and not isDiscussionAllowed"
|
||||||
class="discreet"
|
class="discreet"
|
||||||
i18n:domain="plone.app.discussion"
|
i18n:domain="plone.app.discussion"
|
||||||
i18n:translate="label_commenting_disabled">
|
i18n:translate="label_commenting_disabled">
|
||||||
Commenting has been disabled.
|
Commenting has been disabled.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="reply"
|
<div class="reply"
|
||||||
@ -147,7 +147,7 @@
|
|||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="commenting" class="reply" tal:condition="python:isDiscussionAllowed and (isAnon and isAnonymousDiscussionAllowed or userHasReplyPermission)">
|
<div id="commenting" class="reply" tal:condition="python:isDiscussionAllowed and (isAnon and isAnonymousDiscussionAllowed or userHasReplyPermission)">
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
Loading…
Reference in New Issue
Block a user