Index: quintagroup.formlib.captcha/tags/1.4.3/MANIFEST.in
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/MANIFEST.in	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/MANIFEST.in	(revision 3713)
@@ -0,0 +1,3 @@
+recursive-include docs *
+recursive-include quintagroup *
+global-exclude *pyc
Index: quintagroup.formlib.captcha/tags/1.4.3/README.txt
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/README.txt	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/README.txt	(revision 3713)
@@ -0,0 +1,35 @@
+Introduction
+============
+
+quintagroup.formlib.captcha is a package that allows to add captcha to zope.formlib.
+As a result such forms are prevented from automatic submit.
+
+Captchas in a formlib form
+--------------------------
+
+Using quintagroup.formlib.captcha in a formlib form is simple. Just add a
+Captcha field to your schema, and away you go:
+
+  >>> from zope.interface import Interface
+  >>> from quintagroup.formlib.captcha import Captcha
+  >>> class CaptchaSchema(Interface):
+  ...     captcha = Captcha(
+  ...         title=_(u'Type the code'),
+  ...         description=_(u'Type the code from the picture shown below.'))
+
+and formlib will take care of the rest. The widget associated with this field 
+will render the captcha and verify the use input automatically.
+
+Supported Plone versions
+------------------------
+
+quintagroup.formlib.captcha was tested with Plone 3.x and Plone 4.0.
+
+Authors
+-------
+
+* Vitaliy Podoba
+* Andriy Mylenkyi
+* Vitaliy Stepanov
+
+Copyright (c) "Quintagroup": http://quintagroup.com, 2004-2014
Index: quintagroup.formlib.captcha/tags/1.4.3/docs/HISTORY.txt
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/docs/HISTORY.txt	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/docs/HISTORY.txt	(revision 3713)
@@ -0,0 +1,59 @@
+Changelog
+=========
+
+1.4.3 (2014-06-11)
+----------------------
+
+* New release with resolved in-line validation issue
+  [sorenabell]
+      
+1.4.3-dev (2013-08-16)
+----------------------
+
+* The captcha value was decoded during the in-line validation
+  (compatibility with bugfixed plone.app.form-2.2.3,
+  thanks: Maurits van Rees, issue: http://plone.org/products/plone-captchas/issues/6).
+  [potar]
+
+1.4.2 (2013-07-09)
+------------------
+
+* The in-line validation for captcha was disabled
+  (issue: http://plone.org/products/plone-captchas/issues/6).
+  [potar]
+* The captcha field was made required for preventing hacks (thanks: Sean Fulmer).
+  [potar]
+
+1.4.1 (2011-11-02)
+------------------
+
+* Updated documentation [fenix]
+
+1.4 (2011-08-25)
+----------------
+
+* widget import fixed
+* pyflakes, pep8 clean up
+
+1.3 (2010-09-14)
+----------------
+
+* Added plone-4 support
+  [mylan]
+* Fixed getting context in the widget
+  [mylan]
+* Added docttests
+  [mylan]
+
+1.2 (2010-04-29)
+----------------
+
+* Clean-up code
+* Added tests
+* Add quintagroup.captcha.core, zope.formlib as requirements
+
+
+1.0 (2009-04-22)
+----------------
+
+* Initial release
Index: quintagroup.formlib.captcha/tags/1.4.3/docs/INSTALL.txt
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/docs/INSTALL.txt	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/docs/INSTALL.txt	(revision 3713)
@@ -0,0 +1,40 @@
+quintagroup.formlib.captcha Installation
+========================================
+
+ * When you're reading this you have probably already run
+   ``easy_install quintagroup.formlib.captcha``. Find out how to install setuptools
+   (and EasyInstall) here:
+   http://peak.telecommunity.com/DevCenter/EasyInstall
+
+ * Create a file called ``quintagroup.formlib.captcha-configure.zcml`` in the
+   ``/path/to/instance/etc/package-includes`` directory.  The file
+   should only contain this::
+
+       <include package="quintagroup.formlib.captcha" />
+
+
+Alternatively, if you are using zc.buildout and the plone.recipe.zope2instance
+recipe to manage your project, you can do this:
+
+ * Add ``quintagroup.formlib.captcha`` to the list of eggs to install, e.g.:
+
+    [buildout]
+    ...
+    eggs =
+        ...
+        quintagroup.formlib.captcha
+
+  * Tell the plone.recipe.zope2instance recipe to install a ZCML slug:
+
+    [instance]
+    recipe = plone.recipe.zope2instance
+    ...
+    zcml =
+        quintagroup.formlib.captcha
+
+  * Re-run buildout, e.g. with:
+
+    $ ./bin/buildout
+
+You can skip the ZCML slug if you are going to explicitly include the package
+from another package's configure.zcml file.
Index: quintagroup.formlib.captcha/tags/1.4.3/docs/LICENSE.GPL
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/docs/LICENSE.GPL	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/docs/LICENSE.GPL	(revision 3713)
@@ -0,0 +1,225 @@
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
Index: quintagroup.formlib.captcha/tags/1.4.3/docs/LICENSE.txt
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/docs/LICENSE.txt	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/docs/LICENSE.txt	(revision 3713)
@@ -0,0 +1,16 @@
+  quintagroup.formlib.captcha is copyright Vitaliy Podoba
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+  MA 02111-1307 USA.
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/__init__.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/__init__.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/__init__.py	(revision 3713)
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/__init__.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/__init__.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/__init__.py	(revision 3713)
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/README.txt
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/README.txt	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/README.txt	(revision 3713)
@@ -0,0 +1,74 @@
+============================
+ quintagroup.formlib.captcha
+============================
+
+This package allows to add captcha to zope.formlib form.
+As a result such forms are prevented from automatic submit.
+
+ *example.py* module provides example of usage the *Captcha*
+ field with formlib form.
+
+What you have to do
+-------------------
+
+1. You should add a *Captcha* field to your schema:
+
+  >>> from zope.interface import Interface
+  >>> from quintagroup.formlib.captcha import Captcha
+  >>> class ICaptchaFormlibFormSchema(Interface):
+  ...     # ... your schema definition
+  ...     captcha = Captcha(title=u'Type the code')
+
+2. If your form define Schema adapter (ICaptchaFormlibFormSchema
+adapter in our case), just add *captcha* property.
+
+  >>> from zope.component import adapts
+  >>> from zope.interface import implements
+  >>> class CaptchaFormlibFormAdapter(object):
+  ...     adapts(Interface)
+  ...     implements(ICaptchaFormlibFormSchema)
+  ...     # ... your adapter code
+  ...     captcha = None
+ 
+And away we go.
+
+In tests/tests.zcml we have registered a adapter and page view for test form,
+named @@formlib-captcha-form.
+
+Get browser object .
+    
+    >>> from Products.Five.testbrowser import Browser
+    >>> from Products.PloneTestCase import PloneTestCase as ptc
+    >>> user, pwd = ptc.default_user, ptc.default_password
+    >>> browser = Browser()
+
+Now check if captcha presented on the mentioned form.
+
+    >>> browser.open(self.portal.absolute_url() + '/@@formlib-captcha-form')
+    >>> open("/tmp/test.html", 'w').write(browser.contents)
+    >>> "Type the code" in browser.contents
+    True
+
+
+Now try to submit form with wrong captcha key. Error status message will
+be shown.
+
+    >>> browser.open(self.portal.absolute_url() + '/@@formlib-captcha-form')
+    >>> browser.getControl(name='form.captcha').value = "wrong captcha"
+    >>> browser.getControl(name='form..hashkey').value = self.hashkey
+    >>> browser.getControl(name="form.actions.save").click()
+    >>> "Type the code" in browser.contents
+    True
+    >>> "Please re-enter validation code." in browser.contents
+    True
+
+And now submit form with correct captcha key.
+
+    >>> browser.open(self.portal.absolute_url() + '/@@formlib-captcha-form')
+    >>> browser.getControl(name='form.captcha').value = self.captcha_word
+    >>> browser.getControl(name='form..hashkey').value = self.hashkey
+    >>> browser.getControl(name="form.actions.save").click()
+    >>> "Please re-enter validation code." in browser.contents
+    False
+
+No error shown.
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/__init__.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/__init__.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/__init__.py	(revision 3713)
@@ -0,0 +1,5 @@
+from quintagroup.formlib.captcha.widget import CaptchaWidget
+from quintagroup.formlib.captcha.field import Captcha
+#for pyflakes test
+CaptchaWidget
+Captcha
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/configure.zcml
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/configure.zcml	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/configure.zcml	(revision 3713)
@@ -0,0 +1,21 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    i18n_domain="quintagroup.formlib.captcha">
+
+  <include package="quintagroup.captcha.core" />
+
+  <include zcml:condition="installed five.formlib"
+     package="five.formlib" />
+  <include zcml:condition="not-installed five.formlib"
+     package="zope.formlib" />
+
+  <view
+      type="zope.publisher.interfaces.browser.IBrowserRequest"
+      for=".interfaces.ICaptcha"
+      provides="zope.app.form.interfaces.IInputWidget"
+      factory=".widget.CaptchaWidget"
+      permission="zope.Public"
+      />
+
+</configure>
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/example.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/example.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/example.py	(revision 3713)
@@ -0,0 +1,30 @@
+from zope.schema import TextLine
+from zope.interface import Interface, implements
+from zope.formlib.form import FormFields
+from plone.app.form.base import EditForm
+
+from quintagroup.formlib.captcha import Captcha
+
+
+# Define CaptchaFormlibForm form schema
+class ICaptchaFormlibFormSchema(Interface):
+    label = TextLine(title=u'Label',
+                     required=False)
+    captcha = Captcha(title=u'Type the code')
+
+
+# Create adapter for any object to ICaptchaFormlibFormSchema
+# schema interface
+class CaptchaFormlibFormAdapter(object):
+    implements(ICaptchaFormlibFormSchema)
+
+    def __init__(self, context):
+        self.context = context
+
+    label = u''
+    captcha = None
+
+
+# And at the last define the CaptchaFormlibForm form
+class CaptchaFormlibForm(EditForm):
+    form_fields = FormFields(ICaptchaFormlibFormSchema)
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/field.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/field.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/field.py	(revision 3713)
@@ -0,0 +1,7 @@
+from zope.interface import implements
+from zope.schema import ASCIILine
+from interfaces import ICaptcha
+
+
+class Captcha(ASCIILine):
+    implements(ICaptcha)
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/interfaces.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/interfaces.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/interfaces.py	(revision 3713)
@@ -0,0 +1,5 @@
+from zope.schema.interfaces import IASCIILine
+
+
+class ICaptcha(IASCIILine):
+    u"""A field for captcha validation"""
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/tests/test_doctests.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/tests/test_doctests.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/tests/test_doctests.py	(revision 3713)
@@ -0,0 +1,61 @@
+import unittest
+import doctest
+
+from Products.Five import zcml
+from Products.Five import fiveconfigure
+
+from Products.PloneTestCase import PloneTestCase as ptc
+from Products.PloneTestCase.layer import PloneSite
+from Testing import ZopeTestCase as ztc
+
+from quintagroup.captcha.core.utils import decrypt, parseKey, getWord
+from quintagroup.captcha.core.tests.base import testPatch
+from quintagroup.captcha.core.tests.testWidget import addTestLayer
+
+
+class FormlibCaptchaLayer(PloneSite):
+    @classmethod
+    def setUp(cls):
+        fiveconfigure.debug_mode = True
+        import quintagroup.captcha.core
+        import quintagroup.formlib.captcha
+        zcml.load_config('configure.zcml', quintagroup.formlib.captcha)
+        zcml.load_config('tests.zcml', quintagroup.formlib.captcha.tests)
+        fiveconfigure.debug_mode = False
+        ztc.installPackage('quintagroup.captcha.core')
+
+    @classmethod
+    def tearDown(cls):
+        pass
+
+ptc.setupPloneSite(extension_profiles=['quintagroup.captcha.core:default', ])
+
+
+class FormlibCaptchaTestCase(ptc.FunctionalTestCase):
+    layer = FormlibCaptchaLayer
+
+    def afterSetUp(self):
+        # prepare context
+        self.loginAsPortalOwner()
+        testPatch()
+        addTestLayer(self)
+        # prepare captcha data
+        captcha_key = self.portal.captcha_key
+        self.hashkey = self.portal.getCaptcha()
+        decrypted = decrypt(captcha_key, self.hashkey)
+        self.captcha_word = getWord(int(parseKey(decrypted)['key']) - 1)
+
+
+def test_suite():
+    return unittest.TestSuite([
+
+        # Demonstrate the main content types
+        ztc.ZopeDocFileSuite(
+            'README.txt', package='quintagroup.formlib.captcha',
+            test_class=FormlibCaptchaTestCase,
+            optionflags=doctest.REPORT_ONLY_FIRST_FAILURE |
+            doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS),
+    ])
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/tests/test_unittests.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/tests/test_unittests.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/tests/test_unittests.py	(revision 3713)
@@ -0,0 +1,139 @@
+import re
+import unittest
+
+from zope.schema.interfaces import IField
+from zope.component import queryMultiAdapter
+from zope.publisher.browser import TestRequest
+from zope.app.form.interfaces import IInputWidget
+from zope.app.form.interfaces import ConversionError
+
+from Products.Five import zcml
+from Products.Five import fiveconfigure
+from Testing import ZopeTestCase as ztc
+from Products.PloneTestCase.layer import onsetup
+from Products.PloneTestCase import PloneTestCase as ptc
+
+from quintagroup.captcha.core.utils import decrypt, parseKey, getWord
+from quintagroup.captcha.core.tests.base import testPatch
+from quintagroup.captcha.core.tests.testWidget import addTestLayer
+
+from quintagroup.formlib.captcha import Captcha
+from quintagroup.formlib.captcha import CaptchaWidget
+
+
+@onsetup
+def setup_product():
+    fiveconfigure.debug_mode = True
+    import quintagroup.captcha.core
+    import quintagroup.formlib.captcha
+    zcml.load_config('configure.zcml', quintagroup.formlib.captcha)
+    fiveconfigure.debug_mode = False
+    ztc.installPackage('quintagroup.captcha.core')
+
+setup_product()
+ptc.setupPloneSite(extension_profiles=['quintagroup.captcha.core:default', ])
+
+
+class TestRegistrations(ptc.PloneTestCase):
+
+    def testCaptchaFieldInterface(self):
+        self.assertEqual(IField.implementedBy(Captcha), True)
+
+    def testCaptchaWidgetInterface(self):
+        self.assertEqual(IInputWidget.implementedBy(CaptchaWidget), True)
+
+    def testWidgetRegistration(self):
+        cfield = Captcha()
+        request = TestRequest()
+        cwidget = queryMultiAdapter((cfield, request), IInputWidget)
+        self.assertNotEqual(cwidget, None)
+
+
+class TestCaptchaWidgetHTML(ptc.PloneTestCase):
+    def afterSetUp(self):
+        # app context
+        self.loginAsPortalOwner()
+        # get html output from widget
+        field = Captcha()
+        bound = field.bind(self.portal)
+        widget = CaptchaWidget(bound, self.app.REQUEST)
+        widget.setPrefix('')
+        self.html = widget()
+
+    def testHidden(self):
+        HIDDENTAG = '<input\s+[^>]*(?:' \
+            '(?:type="hidden"\s*)|' \
+            '(?:name="hashkey"\s*)|' \
+            '(?:value="(?P<value>[0-9a-fA-F]+)"\s*)' \
+            '){3}/>'
+        hidden = re.search(HIDDENTAG, self.html)
+        self.assertTrue(hidden and hidden.group('value'))
+
+    def testImg(self):
+        IMAGETAG = '<img\s+[^>]*src=\"' \
+            '(?P<src>[^\"]*/getCaptchaImage/[0-9a-fA-F]+)' \
+            '\"[^>]*>'
+        img = re.search(IMAGETAG, self.html)
+        self.assertTrue(img and img.group('src'))
+
+    def testTextField(self):
+        FIELDTAG = '<input\s+[^>]*type=\"text\"\s*[^>]*>'
+        self.assertEqual(re.search(FIELDTAG, self.html) is not None, True)
+
+
+class TestCaptchaWidgetToField(ptc.PloneTestCase):
+
+    def afterSetUp(self):
+        # prepare context
+        self.loginAsPortalOwner()
+        testPatch()
+        addTestLayer(self)
+        self.captcha_key = self.portal.captcha_key
+        # prepare widget
+        field = Captcha()
+        bound = field.bind(self.portal)
+        self.request = self.app.REQUEST
+        self.widget = CaptchaWidget(bound, self.request)
+        self.widget.setPrefix('')
+        # prepare captcha data
+        self.hashkey = self.portal.getCaptcha()
+        self.request.form['hashkey'] = self.hashkey
+
+    def testSubmitRightCaptcha(self):
+        decrypted = decrypt(self.captcha_key, self.hashkey)
+        key = getWord(int(parseKey(decrypted)['key']) - 1)
+        try:
+            res = self.widget._toFieldValue(key)
+        except ConversionError, e:
+            self.fail("Rised unexpected %s error on right captcha submit" %
+                      e.doc())
+        else:
+            self.assertEqual(res, key)
+
+    def testSubmitWrongCaptcha(self):
+        try:
+            self.widget._toFieldValue("wrong key")
+        except ConversionError, e:
+            self.assertEqual(e.doc(), u'Please re-enter validation code.')
+        else:
+            self.fail("No ConversionError rised on wrong captcha key submit")
+
+    def testSubmitRightCaptchaTwice(self):
+        decrypted = decrypt(self.captcha_key, self.hashkey)
+        key = getWord(int(parseKey(decrypted)['key']) - 1)
+        self.widget._toFieldValue(key)
+        try:
+            self.widget._toFieldValue(key)
+        except ConversionError, e:
+            self.assertEqual(e.doc(), u'Please re-enter validation code.')
+        else:
+            self.fail("No ConversionError rised on right captcha key "
+                      "submitting twice")
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(TestRegistrations))
+    suite.addTest(unittest.makeSuite(TestCaptchaWidgetHTML))
+    suite.addTest(unittest.makeSuite(TestCaptchaWidgetToField))
+    return suite
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/tests/tests.zcml
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/tests/tests.zcml	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/tests/tests.zcml	(revision 3713)
@@ -0,0 +1,25 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser">
+
+  <adapter
+     for="*"
+     factory="quintagroup.formlib.captcha.example.CaptchaFormlibFormAdapter" />
+
+  <!-- register plone.app.form.default_named_template_adapter
+       for our form to use default plone's formlib form       -->
+  <adapter
+      for="quintagroup.formlib.captcha.example.CaptchaFormlibForm"
+      factory="plone.app.form.default_named_template_adapter"
+      name="default"
+      provides="zope.formlib.namedtemplate.INamedTemplate"
+      />
+
+  <browser:page
+      name="formlib-captcha-form"
+      for="*"
+      class="quintagroup.formlib.captcha.example.CaptchaFormlibForm"
+      permission="zope2.View"
+      />
+    
+</configure>
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/version.txt
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/version.txt	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/version.txt	(revision 3713)
@@ -0,0 +1,1 @@
+1.4.3
Index: quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/widget.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/widget.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/quintagroup/formlib/captcha/widget.py	(revision 3713)
@@ -0,0 +1,134 @@
+from DateTime import DateTime
+
+try:
+    from zope.site.hooks import getSite
+    getSite()
+except ImportError:
+    from zope.app.component.hooks import getSite
+from zope.app.form.browser import ASCIIWidget
+from zope.app.form.interfaces import ConversionError
+from zope.app.form.browser.widget import renderElement
+from zope.i18n import MessageFactory
+
+from Acquisition import aq_parent
+
+from Products.CMFCore.utils import getToolByName
+from Products.CMFCore.interfaces import ISiteRoot
+
+from quintagroup.captcha.core.utils import (decrypt, parseKey,
+                                            encrypt1, getWord,
+                                            detectInlineValidation)
+
+try:
+    from plone.app.form import inline_validation
+except ImportError:
+    # BBB Plone < 4.3 compatibility.
+    # The implementation of inline validation was switched
+    # to a non-KSS-based in plone.app.form-2.2.0
+    try:
+        from plone.app.form.kss import validation as inline_validation
+    # BBB: Plone 3.0 compatibility.
+    # The KSS validation was added in plone.app.form-1.1.0.
+    except:
+        inline_validation = None
+
+_ = MessageFactory('quintagroup.formlib.captcha')
+
+import logging
+
+logger = logging.getLogger('quintagroup.formlib.captcha')
+
+
+class CaptchaWidget(ASCIIWidget):
+
+    def get_site(self):
+        # get from plone.app.form.widgets.wysiwygwdget
+        site = getSite()
+        while site is not None and not ISiteRoot.providedBy(site):
+            site = aq_parent(site)
+        return site
+
+    def __call__(self):
+        kwargs = {'type': self.type,
+                  'name': self.name,
+                  'id': self.name,
+                  'cssClass': self.cssClass,
+                  'style': self.style,
+                  'size': self.displayWidth,
+                  'extra': self.extra}
+
+        site = self.get_site()
+        portal_url = getToolByName(site, 'portal_url')()
+        key = site.getCaptcha()
+
+        if self._prefix:
+            prefix = '%s.' % self._prefix
+        else:
+            prefix = ''
+
+        return u"""<input type="hidden" value="%s" name="%shashkey" />
+                   %s
+                   <img src="%s/getCaptchaImage/%s"
+                        alt="Enter the word"/>""" % (key,
+                                                     prefix,
+                                                     renderElement(self.tag,
+                                                                   **kwargs),
+                                                     portal_url,
+                                                     key)
+
+    def hasInput(self):
+        # The validator looks for the captcha only if the captcha field
+        # is present. If the captcha field is omitted from the request,
+        # then the captcha validation never happens. That's why 'required'
+        # option is useless. So, we have to simulate 'required': set up 'True'
+        # for the captcha input.
+        return True
+
+    def _getFormInput(self):
+        """ It returns current form input. """
+        # The original method isn't suitable when the captcha field
+        # is omitted from the request.
+        return self.request.get(self.name, u'')
+
+    def _toFieldValue(self, input):
+        # Captcha validation is one-time process to prevent hacking
+        # This is the reason for in-line validation to be disabled.
+        if inline_validation and detectInlineValidation(inline_validation):
+            return super(CaptchaWidget, self)._toFieldValue(input)
+
+        # Verify the user input against the captcha.
+        # Get captcha type (static or dynamic)
+        site = self.get_site()
+        captcha_type = site.getCaptchaType()
+
+        # validate captcha input
+        if input and captcha_type in ['static', 'dynamic']:
+            # make up form prefix
+            if self._prefix:
+                prefix = '%s.' % self._prefix
+            else:
+                prefix = ''
+
+            hashkey = self.request.get('%shashkey' % prefix, '')
+            decrypted_key = decrypt(site.captcha_key, hashkey)
+            parsed_key = parseKey(decrypted_key)
+
+            index = parsed_key['key']
+            date = parsed_key['date']
+
+            if captcha_type == 'static':
+                img = getattr(site, '%s.jpg' % index)
+                solution = img.title
+                enc = encrypt1(input)
+            else:
+                enc = input
+                solution = getWord(int(index))
+
+            captcha_tool = getToolByName(site, 'portal_captchas')
+            if (enc != solution) or (decrypted_key in captcha_tool.keys()) or \
+               (DateTime().timeTime() - float(date) > 3600):
+                raise ConversionError(_(u'Please re-enter validation code.'))
+            else:
+                captcha_tool.addExpiredKey(decrypted_key)
+
+        return super(CaptchaWidget, self)._toFieldValue(input)
Index: quintagroup.formlib.captcha/tags/1.4.3/setup.cfg
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/setup.cfg	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/setup.cfg	(revision 3713)
@@ -0,0 +1,3 @@
+[egg_info]
+tag_build = dev
+tag_svn_revision = true
Index: quintagroup.formlib.captcha/tags/1.4.3/setup.py
===================================================================
--- quintagroup.formlib.captcha/tags/1.4.3/setup.py	(revision 3713)
+++ quintagroup.formlib.captcha/tags/1.4.3/setup.py	(revision 3713)
@@ -0,0 +1,49 @@
+from setuptools import setup, find_packages
+import os
+
+version = '1.4.3'
+
+setup(name='quintagroup.formlib.captcha',
+      version=version,
+      description="Captcha field for formlib based on "
+                  "quintagroup.captcha.core package",
+      long_description=open("README.txt").read() + "\n" +
+      open(os.path.join("docs", "HISTORY.txt")).read(),
+      classifiers=[
+          "Development Status :: 5 - Production/Stable",
+          "Environment :: Web Environment",
+          "Framework :: Plone",
+          "Framework :: Plone :: 3.2",
+          "Framework :: Plone :: 3.3",
+          "Framework :: Plone :: 4.0",
+          "Framework :: Plone :: 4.1",
+          "Framework :: Plone :: 4.2",
+          "Framework :: Plone :: 4.3",
+          "Framework :: Zope2",
+          "Framework :: Zope3",
+          "License :: OSI Approved :: GNU General Public License (GPL)",
+          "Operating System :: OS Independent",
+          "Programming Language :: Python",
+          "Topic :: Security",
+          "Topic :: Software Development :: Libraries :: Python Modules",
+      ],
+      keywords='plone formlib captcha',
+      author='Quintagroup',
+      author_email='support@quintagroup.com',
+      url='http://svn.quintagroup.com/products/quintagroup.formlib.captcha',
+      license='GPL',
+      packages=find_packages(exclude=['ez_setup']),
+      namespace_packages=['quintagroup', 'quintagroup.formlib'],
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=[
+          'setuptools',
+          # -*- Extra requirements: -*-
+          'quintagroup.captcha.core >= 0.4.3',
+          'zope.app.form',
+          'zope.formlib',
+      ],
+      entry_points="""
+      # -*- Entry points: -*-
+      """,
+      )
