Index: /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/__init__.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/__init__.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/__init__.py	(revision 3168)
@@ -2,20 +2,26 @@
 from Products.Archetypes.atapi import process_types, listTypes
 
-from config import PROJECTNAME
-from config import ADD_PERMISSION
+from quintagroup.pfg.captcha.config import PROJECTNAME
+from quintagroup.pfg.captcha.config import ADD_PERMISSION
 
-from field import CaptchaField
-from widget import CaptchaWidget
-from validator import CaptchaValidator
+from quintagroup.pfg.captcha.field import CaptchaField
+from quintagroup.pfg.captcha.widget import CaptchaWidget
+from quintagroup.pfg.captcha.validator import CaptchaValidator
+#for pyflakes test
+CaptchaField
+CaptchaWidget
+CaptchaValidator
+
 
 def initialize(context):
 
-    content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME)
+    content_types, constructors, ftis = process_types(listTypes(PROJECTNAME),
+                                                      PROJECTNAME)
 
     utils.ContentInit(
         PROJECTNAME + ' Content',
-        content_types      = content_types,
-        permission         = ADD_PERMISSION,
-        extra_constructors = constructors,
-        fti                = ftis,
+        content_types=content_types,
+        permission=ADD_PERMISSION,
+        extra_constructors=constructors,
+        fti=ftis,
         ).initialize(context)
Index: /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/config.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/config.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/config.py	(revision 3168)
@@ -5,9 +5,10 @@
 ADD_PERMISSION = cmfcore_permissions.AddPortalContent
 
-try: 
-    # Plone 4 and higher 
-    import plone.app.upgrade 
-    PLONE_VERSION = 4 
-except ImportError: 
+try:
+    # Plone 4 and higher
+    import plone.app.upgrade
+    PLONE_VERSION = 4
+    # for pyflakes test
+    plone
+except ImportError:
     PLONE_VERSION = 3
-
Index: /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/field.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/field.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/field.py	(revision 3168)
@@ -3,11 +3,11 @@
 from Products.CMFCore.permissions import View
 
-from Products.Archetypes.atapi import *
+from Products.Archetypes.atapi import StringField
 from Products.ATContentTypes.content.base import registerATCT
 
 from Products.PloneFormGen.content.fields import FGStringField
-from Products.PloneFormGen.content.fieldsBase import BareFieldSchema
 from Products.PloneFormGen.content.fieldsBase import BaseFormField
-from Products.PloneFormGen.content.fieldsBase import BaseFieldSchemaStringDefault
+from Products.PloneFormGen.content.fieldsBase \
+        import BaseFieldSchemaStringDefault
 
 from quintagroup.pfg.captcha.config import PROJECTNAME
@@ -16,23 +16,26 @@
 CAPTCHA_ID = 'key'
 HIDDEN_FIELDS = [
-    'title', 
+    'title',
     'description',
-    'required', 
-    'hidden', 
-    'fgTDefault', 
-    'fgTEnabled', 
+    'required',
+    'hidden',
+    'fgTDefault',
+    'fgTEnabled',
     'fgDefault',
     'fgTValidator']
 
-def finalizeCaptchaFieldSchema( schema ):
-    schema['title'].default= 'key'
+
+def finalizeCaptchaFieldSchema(schema):
+    schema['title'].default = 'key'
     for field in HIDDEN_FIELDS:
-        schema[field].widget.visible = {'view':'invisible','edit':'invisible'}
+        schema[field].widget.visible = {'view': 'invisible',
+                                        'edit': 'invisible'}
 
 CaptchaFieldSchema = BaseFieldSchemaStringDefault.copy()
-finalizeCaptchaFieldSchema( CaptchaFieldSchema )
+finalizeCaptchaFieldSchema(CaptchaFieldSchema)
+
 
 def addCaptchaField(self, id, **kwargs):
-    id = CAPTCHA_ID 
+    id = CAPTCHA_ID
     obj = CaptchaField(id)
     notify(ObjectCreatedEvent(obj))
@@ -42,4 +45,5 @@
     notify(ObjectModifiedEvent(obj))
     return obj.getId()
+
 
 class CaptchaField(FGStringField):
@@ -56,5 +60,5 @@
             searchable=0,
             required=1,
-            write_permission = View,
+            write_permission=View,
             validators=('isCaptchaCorrect',),
             widget=CaptchaWidget(),
Index: /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/setuphandlers.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/setuphandlers.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/setuphandlers.py	(revision 3168)
@@ -6,6 +6,8 @@
 captcha_fields = []
 
+
 def migrateToPackage(context):
-    """Collect old Products.qPloneCaptchaFields fields (before types tool setup).
+    """
+    Collect old Products.qPloneCaptchaFields fields (before types tool setup).
     """
     global captcha_fields
@@ -20,5 +22,6 @@
         catalog = plone_tools.catalog()
         captcha_fields = [(cf.id, cf.getObject().aq_parent) \
-                          for cf in catalog.search({'portal_type':'CaptchaField'})]
+                          for cf in catalog.search(
+                                {'portal_type': 'CaptchaField'})]
         logger.info("Old Products.qPloneCaptchaField fields collected.")
 
Index: /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/base.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/base.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/base.py	(revision 3168)
@@ -1,5 +1,2 @@
-import re
-import string
-import unittest
 import transaction
 
@@ -16,5 +13,5 @@
     'quintagroup.pfg.captcha',
 ]
-REQUIREMENTS = ['PloneFormGen',] + PACKAGES
+REQUIREMENTS = ['PloneFormGen', ] + PACKAGES
 
 ptc.setupPloneSite()
@@ -24,4 +21,5 @@
 # !!! method of the layer class.
 ztc.installProduct('PloneFormGen')
+
 
 class NotInstalled(PloneSite):
@@ -60,5 +58,5 @@
     def tearDown(cls):
         ptc_setup._placefulTearDown()
-        
+
 
 class TestCase(ptc.PloneTestCase):
Index: /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/testInstalled.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/testInstalled.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/testInstalled.py	(revision 3168)
@@ -1,3 +1,4 @@
-from base import *
+import string
+import unittest
 
 from Products.CMFCore.permissions import View
@@ -11,6 +12,8 @@
 from quintagroup.pfg.captcha.widget import CAPTCHA_MACRO
 from quintagroup.pfg.captcha.field import CAPTCHA_ID, HIDDEN_FIELDS
+from quintagroup.pfg.captcha.tests.base import TestCase, REQUIREMENTS
 
 _marker = object()
+
 
 class TestInstallations(TestCase):
@@ -37,5 +40,5 @@
         default_chain = pw.getDefaultChain()
         cf_chain = pw.getChainForPortalType('CaptchaField')
-        self.assertNotEqual(cf_chain == default_chain , True)
+        self.assertNotEqual(cf_chain == default_chain, True)
 
     def testNotToList(self):
@@ -70,5 +73,6 @@
         for field in HIDDEN_FIELDS:
             visibility = schema[field].widget.visible
-            self.assertEqual(visibility, {'view':'invisible','edit':'invisible'},
+            self.assertEqual(visibility, {'view': 'invisible',
+                                          'edit': 'invisible'},
                 '"%s" field is not hidden, but %s:' % (field, visibility))
 
@@ -79,5 +83,5 @@
         # Test fgField properties
         self.assertEqual(type(fgField), StringField)
-        self.assertEqual(bool(fgField.searchable), False )
+        self.assertEqual(bool(fgField.searchable), False)
         self.assertEqual(fgField.write_permission, View)
         self.assertEqual(type(fgField.widget), CaptchaWidget)
@@ -111,5 +115,5 @@
 
     def getValidator(self):
-        return validation.validatorFor('isCaptchaCorrect')        
+        return validation.validatorFor('isCaptchaCorrect')
 
     def testRegistration(self):
@@ -121,7 +125,7 @@
             def __init__(self, status, error=""):
                 self.status = status
-                self.errors = {'key':[error,]}
+                self.errors = {'key': [error, ]}
 
-        patch_validator = lambda : MockState(status, error)
+        patch_validator = lambda: MockState(status, error)
         self.portal.captcha_validator = patch_validator
 
@@ -133,5 +137,5 @@
         result = validator('test', instance=self.portal)
         self.assertEqual(result, 1)
-        
+
     def testValidationFailure(self):
         # PFG validator must call patched quintagroup.captcha.core'
Index: /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/testMigration.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/testMigration.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/testMigration.py	(revision 3168)
@@ -1,6 +1,5 @@
-from base import *
-from Products.PloneTestCase.setup import cleanupPloneSite
-from Products.PloneTestCase.setup import portal_name
-from Products.PloneTestCase.setup import SiteCleanup
+import unittest
+from quintagroup.pfg.captcha.tests.base import TestCaseNotInstalled
+
 
 class TestMigration(TestCaseNotInstalled):
@@ -32,5 +31,5 @@
 
     def beforeTearDown(self):
-        self.qi.uninstallProducts(["quintagroup.pfg.captcha",])
+        self.qi.uninstallProducts(["quintagroup.pfg.captcha", ])
 
     def prepareToMigration(self):
@@ -42,12 +41,13 @@
         test_form.invokeFactory("CaptchaField", 'test_captcha_field')
         self.cf_path = "test_form/key"
-        self.old_cf = self.portal.unrestrictedTraverse(self.cf_path) 
+        self.old_cf = self.portal.unrestrictedTraverse(self.cf_path)
         self.assert_(self.old_cf)
-        self.pt['CaptchaField'].manage_changeProperties(product="qPloneCaptchaField")
+        self.pt['CaptchaField'].manage_changeProperties(
+            product="qPloneCaptchaField")
         self.qi.manage_delObjects('quintagroup.pfg.captcha')
 
     def testMigration(self):
         self.addProduct("quintagroup.pfg.captcha")
-        new_cf = self.portal.unrestrictedTraverse(self.cf_path) 
+        new_cf = self.portal.unrestrictedTraverse(self.cf_path)
         self.assert_(self.old_cf != new_cf)
 
Index: /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/validator.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/validator.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/validator.py	(revision 3168)
@@ -2,7 +2,7 @@
 from Products.validation import validation
 from Products.validation.interfaces.IValidator import IValidator
-from Products.CMFPlone.utils import safe_hasattr
 
-from config import PLONE_VERSION
+from quintagroup.pfg.captcha.config import PLONE_VERSION
+
 
 class CaptchaValidator:
@@ -19,9 +19,9 @@
     def __call__(self, value, *args, **kwargs):
 
-        form  = kwargs.get('instance')
+        form = kwargs.get('instance')
         portal = getToolByName(form, 'portal_url').getPortalObject()
         result = portal.captcha_validator()
         if result.status == 'failure':
-            return ("%(problem)s" % {'problem' : result.errors['key'][0]})
+            return ("%(problem)s" % {'problem': result.errors['key'][0]})
         else:
             return 1
Index: /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/widget.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/widget.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/widget.py	(revision 3168)
@@ -4,12 +4,13 @@
 CAPTCHA_MACRO = "captchaField_widget"
 
+
 class CaptchaWidget(StringWidget):
     _properties = StringWidget._properties.copy()
-    _properties.update( {'macro' : CAPTCHA_MACRO} )
+    _properties.update({'macro': CAPTCHA_MACRO})
 
 
 registerWidget(CaptchaWidget,
-               title = 'Captcha widget',
-               description= ('Renders captcha image and string input',),
-               used_for = ('quintagroup.pfg.captcha.field.CaptchaField',)
+               title='Captcha widget',
+               description=('Renders captcha image and string input',),
+               used_for=('quintagroup.pfg.captcha.field.CaptchaField',)
               )
Index: /quintagroup.pfg.captcha/trunk/setup.py
===================================================================
--- /quintagroup.pfg.captcha/trunk/setup.py	(revision 3167)
+++ /quintagroup.pfg.captcha/trunk/setup.py	(revision 3168)
@@ -6,8 +6,8 @@
 setup(name='quintagroup.pfg.captcha',
       version=version,
-      description="quintagroup.pfg.captcha is a package that allows to add captcha field to PloneFormGen forms.",
+      description="quintagroup.pfg.captcha is a package that allows "
+                  "to add captcha field to PloneFormGen forms.",
       long_description=open("README.txt").read() + "\n" +
                        open(os.path.join("docs", "HISTORY.txt")).read(),
-      # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
       classifiers=[
         "Framework :: Plone",
@@ -18,5 +18,6 @@
       author='Quintagroup',
       author_email='support@quintagroup.com',
-      url='http://projects.quintagroup.com/products/wiki/quintagroup.pfg.captcha',
+      url='http://projects.quintagroup.com/products/wiki/'\
+          'quintagroup.pfg.captcha',
       license='GPL',
       packages=find_packages(exclude=['ez_setup']),
