Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/__init__.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/__init__.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/__init__.py	(revision 3114)
@@ -3,4 +3,4 @@
 # Feed our monkeys :-)
 from quintagroup.plonecomments import patch
-
+patch
 allow_module('quintagroup.plonecomments.utils')
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/browser/comments.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/browser/comments.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/browser/comments.py	(revision 3114)
@@ -2,4 +2,5 @@
 try:
     import hashlib as md5
+    md5.md5
 except ImportError:
     import md5
@@ -39,5 +40,5 @@
     def getGravatar(self, reply):
         purl = getToolByName(self.context, 'portal_url')
-        mtool = getToolByName(self.context, 'portal_membership')            
+        mtool = getToolByName(self.context, 'portal_membership')
         portrait_url = purl() + '/defaultUser.gif' 
         email = ''
@@ -63,5 +64,4 @@
             'default':portrait_url, 'size':str(size)})
         return gravatar_url
-        
 
     def authenticated_report_abuse_enabled(self):
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/config.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/config.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/config.py	(revision 3114)
@@ -2,6 +2,6 @@
 
 LOGGER = 'quintagroup.plonecomments'
+PRODUCTS = []
 
-PRODUCTS = []
 
 def warning(msg):
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/patch.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/patch.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/patch.py	(revision 3114)
@@ -2,4 +2,5 @@
 try:
     from App.class_init import InitializeClass
+    InitializeClass
 except ImportError:
     from Globals import InitializeClass
@@ -18,5 +19,5 @@
 
     id = int(DateTime().timeTime())
-    while self._container.get(str(id), None) is not None:
+    while container.get(str(id), None) is not None:
         id += 1
     id = str(id)
@@ -30,5 +31,5 @@
             item.creator = Creator
 
-    self._container[id] = item
+    container[id] = item
     item = item.__of__(self)
 
@@ -45,5 +46,5 @@
     if getProp(self, 'enable_moderation', marker=False):
         roles = [role['name'] for role in self.acl_users.rolesOfPermission('Moderate Discussion')
-                 if role['selected']== 'SELECTED']
+                 if role['selected'] == 'SELECTED']
         roles.append('DiscussionManager')
         item.manage_permission('Delete objects', roles, acquire=1)
@@ -57,5 +58,5 @@
     return id
 
-def getReplies( self ):
+def getReplies(self):
     """Return a sequence of the DiscussionResponse objects which are
        associated with this Discussable.
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/setuphandlers.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/setuphandlers.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/setuphandlers.py	(revision 3114)
@@ -44,5 +44,5 @@
     logger = context.getLogger(LOGGER)
 
-    portal_conf=getToolByName(context.getSite(),'portal_controlpanel')
+    portal_conf=getToolByName(portal, 'portal_controlpanel')
     portal_conf.unregisterConfiglet('prefs_comments_setup_form')
     logger.info('Unregister configlet prefs_comments_setup_form. ')
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/base.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/base.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/base.py	(revision 3114)
@@ -4,10 +4,6 @@
 
 from Testing import ZopeTestCase as ztc
-from AccessControl.SecurityManagement import newSecurityManager, \
-    noSecurityManager
-
 from Products.PloneTestCase import PloneTestCase as ptc
-from Products.PloneTestCase.layer import onsetup, PloneSiteLayer
-from Products.CMFCore.utils import getToolByName
+from Products.PloneTestCase.layer import onsetup
 
 from quintagroup.plonecomments.tests.config import PRODUCT
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsCommenting.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsCommenting.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsCommenting.py	(revision 3114)
@@ -16,5 +16,5 @@
         self.request = self.app.REQUEST
 
-	# VERY IMPORTANT to guarantee product skin's content visibility
+        # VERY IMPORTANT to guarantee product skin's content visibility
         self._refreshSkinData()
 
@@ -23,10 +23,10 @@
         for user_id in USERS.keys():
             self.membership.addMember(user_id, USERS[user_id]['passw'],
-	        USERS[user_id]['roles'], [])
+                USERS[user_id]['roles'], [])
 
         # Add users to Discussion Manager group
         portal_groups = getToolByName(self.portal, 'portal_groups')
         dm_group = portal_groups.getGroupById('DiscussionManager')
-        dm_users = [dm_group.addMember(u) for u in DM_USERS_IDS]
+        [dm_group.addMember(u) for u in DM_USERS_IDS]
 
         # Allow discussion for Document
@@ -71,5 +71,5 @@
         replies_after = len(self.discussion.getDiscussionFor(doc_obj).getReplies())
         self.failUnless(replies_after-replies_before,
-	    "Anonymous user CAN'T really add comment in terned ON *Anonymous commenting mode*.")
+            "Anonymous user CAN'T really add comment in terned ON *Anonymous commenting mode*.")
 
     def testAddCommentToDocNotAnonymUsers(self):
@@ -119,5 +119,5 @@
                 self.login(u)
             self.assertRaises(Unauthorized, doc_obj.discussion_reply,
-	        "%s's reply" % u, "text of '%s' reply" % u)
+                "%s's reply" % u, "text of '%s' reply" % u)
             self.login('dm_admin')
             replies_after = self.discussion.getDiscussionFor(doc_obj).getReplies()
@@ -126,6 +126,6 @@
                 failed_users.append(u)
         self.failIf(failed_users,
-	    "%s user(s) CAN really add comment in terned OFF "
-	    "*Anonymous commenting mode*." % failed_users)
+            "%s user(s) CAN really add comment in terned OFF "
+            "*Anonymous commenting mode*." % failed_users)
 
 
@@ -151,6 +151,6 @@
                 failed_users.append(u)
         self.failIf(failed_users,
-	    "%s - user(s) can not really add commentin terned OFF "
-	    "*Anonymous commenting mode*." % failed_users)
+            "%s - user(s) can not really add commentin terned OFF "
+            "*Anonymous commenting mode*." % failed_users)
 
 
@@ -194,5 +194,5 @@
                 failed_users.append(u)
         self.failIf(failed_users,
-	    "%s - member(s) of DiscussionManager group CAN'T really ADD comment" % failed_users)
+            "%s - member(s) of DiscussionManager group CAN'T really ADD comment" % failed_users)
 
         # This is actual only in terned OFF *Anonymous commenting mode*
@@ -210,6 +210,6 @@
                 failed_users.append(u)
         self.failIf(failed_users,
-	    "%s user(s) CAN really add comment in terned OFF "
-	    "*Anonymous commenting mode*." % failed_users)
+            "%s user(s) CAN really add comment in terned OFF "
+            "*Anonymous commenting mode*." % failed_users)
 
     """
@@ -263,5 +263,5 @@
                 failed_users.append(u)
         self.failIf(failed_users,
-	    "%s - user(s) can not really add comment to PUBLISHED reply." % failed_users)
+            "%s - user(s) can not really add comment to PUBLISHED reply." % failed_users)
 
         # 3.Check adding reply to reply for illegal users
@@ -274,5 +274,5 @@
             self.discussion.getDiscussionFor(reply)
             self.assertRaises(Unauthorized, reply.discussion_reply,
-	        "Reply %s" % u, "text of %s reply" % u)
+                "Reply %s" % u, "text of %s reply" % u)
 
 
@@ -304,5 +304,5 @@
         self.discussion.getDiscussionFor(doc_obj)
         doc_obj.discussion_reply("A Reply to '%s'" % self.doc_moder_off_id,
-	    "text of reply to '%s'" % self.doc_moder_off_id)
+            "text of reply to '%s'" % self.doc_moder_off_id)
 
 
@@ -330,6 +330,6 @@
                 failed_users.append(u)
         self.failIf(failed_users ,
-	    "%s - member(s) CAN'T really ADD comment in terned off"
-	    " comments Moderation mode." % failed_users)
+            "%s - member(s) CAN'T really ADD comment in terned off"
+            " comments Moderation mode." % failed_users)
 
 
@@ -350,5 +350,5 @@
             self.discussion.getDiscussionFor(reply_to_doc)
             self.assertRaises(Unauthorized, reply_to_doc.discussion_reply,
-	    "%s's reply" % u, "text of '%s' reply" % u)
+            "%s's reply" % u, "text of '%s' reply" % u)
 
 
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsConfiglet.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsConfiglet.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsConfiglet.py	(revision 3114)
@@ -21,5 +21,5 @@
     portal_groups = getToolByName(self.portal, 'portal_groups')
     dm_group = portal_groups.getGroupById('DiscussionManager')
-    dm_users = [dm_group.addMember(u) for u in DM_USERS_IDS]
+    [dm_group.addMember(u) for u in DM_USERS_IDS]
 
 
@@ -61,12 +61,13 @@
 
         # Add testing document to portal
-        my_doc = self.portal.invokeFactory('Document', id='my_doc')
+        self.portal.invokeFactory('Document', id='my_doc')
         self.my_doc = self.portal['my_doc']
         self.my_doc.edit(text_format='plain', text='hello world')
 
     def testAnonymousCommenting(self):
-        getPortalReplyPerm = self.portal.rolesOfPermission
         def getReplyRoles():
-            return [r['name'] for r in getPortalReplyPerm(ReplyToItem) if r['selected']=='SELECTED']
+            return [r['name']
+                    for r in self.portal.rolesOfPermission(ReplyToItem)
+                    if r['selected'] == 'SELECTED']
         # Simulate switching ON Anonymous Commenting
         self.request.form['enable_anonymous_commenting'] = 'True'
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsModeration.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsModeration.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsModeration.py	(revision 3114)
@@ -204,5 +204,4 @@
         for u in managers:
             self.login(u)
-            auth = '%s:%s' % (u,USERS[u]['passw'])
             doc_id = "doc_%s" % u
             doc_obj = getattr(self.portal, doc_id)
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotification.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotification.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotification.py	(revision 3114)
@@ -27,5 +27,5 @@
     def afterSetUp(self):
         self.portal._original_MailHost = self.portal.MailHost
-        self.portal.MailHost = mailhost = MockMailHost('MailHost')
+        self.portal.MailHost = MockMailHost('MailHost')
 
         self.loginAsPortalOwner()
@@ -62,5 +62,5 @@
 
         # Add testing document to portal
-        my_doc = self.portal.invokeFactory('Document', id='my_doc', title='Doc')
+        self.portal.invokeFactory('Document', id='my_doc', title='Doc')
         self.my_doc = self.portal['my_doc']
         self.my_doc.edit(text_format='plain', text='hello world')
@@ -126,5 +126,5 @@
         reply = self.discussion.getDiscussionFor(self.my_doc).getReplies()[0]
         reply.discussion_reply('A Reply for comment' ,'text of reply for comment')
-        reply_for_comment = self.discussion.getDiscussionFor(self.my_doc).getReplies()[0]
+        self.discussion.getDiscussionFor(self.my_doc).getReplies()[0]
         self.failUnless(testMailExistance(self), 'Mail was not sended when enable_reply_user_notification.')
 
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotificationRecipients.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotificationRecipients.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotificationRecipients.py	(revision 3114)
@@ -40,5 +40,5 @@
     def afterSetUp(self):
         self.portal._original_MailHost = self.portal.MailHost
-        self.portal.MailHost = mailhost = MockMailHost('MailHost')
+        self.portal.MailHost = MockMailHost('MailHost')
 
         self.loginAsPortalOwner()
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsReportAbuse.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsReportAbuse.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsReportAbuse.py	(revision 3114)
@@ -1,6 +1,4 @@
-from Products.CMFCore.utils import getToolByName
 from quintagroup.plonecomments.tests.testQPloneCommentsCommenting import \
     TestCommBase
-from zExceptions import Unauthorized
 
 
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/tests.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/tests.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/tests.py	(revision 3114)
@@ -1,9 +1,8 @@
 import unittest
 
-from zope.testing import doctestunit
-from zope.component import testing
-from Testing import ZopeTestCase as ztc
-
-from base import getToolByName, TestCase
+#from zope.testing import doctestunit
+#from zope.component import testing
+#from Testing import ZopeTestCase as ztc
+#from base import TestCase
 
 def test_suite():
Index: quintagroup.plonecomments/trunk/quintagroup/plonecomments/utils.py
===================================================================
--- quintagroup.plonecomments/trunk/quintagroup/plonecomments/utils.py	(revision 3113)
+++ quintagroup.plonecomments/trunk/quintagroup/plonecomments/utils.py	(revision 3114)
@@ -1,9 +1,7 @@
 import smtplib
-from zope.i18n import translate
 from zope.i18nmessageid import MessageFactory
 _ = MessageFactory("quintagroup.plonecomments")
 from Products.CMFCore.utils import getToolByName
 from Products.CMFPlone.utils import safe_unicode
-from config import warning
 
 # Get apropriate property from (propery_sheeet) configlet
@@ -13,5 +11,5 @@
     config_ps = getattr(pp, 'qPloneComments', None)
     if config_ps:
-        result =  getattr(config_ps, prop_name, marker)
+        result = getattr(config_ps, prop_name, marker)
     return result
 
@@ -179,5 +177,5 @@
             subject = translate(_(u"published_notification_subject",
                 default=u"[${organization_name}] New comment added",
-                mapping={u"organization_name" : organization_name}),
+                mapping={u"organization_name": organization_name}),
                 context=context.REQUEST)
         else:
@@ -194,5 +192,5 @@
             subject = translate(_(u"approve_notification_subject",
                 default=u"[${organization_name}] New comment awaits moderation",
-                mapping={u"organization_name" : organization_name}),
+                mapping={u"organization_name": organization_name}),
                 context=context.REQUEST)
         else:
@@ -211,10 +209,10 @@
                     'mfrom': admin_email,
                     'obj': reply_parent,
-                    'message':message,
+                    'message': message,
                     'organization_name': organization_name,
                     'name': creator_name,
-                    'comment_id':comment_id,
-                    'comment_desc':comment.description,
-                    'comment_text':comment.text}
+                    'comment_id': comment_id,
+                    'comment_desc': comment.description,
+                    'comment_text': comment.text}
             subject = translate(_(u"report_abuse_subject",
                 default=u"[${organization_name}] A comment on ${title} has "
@@ -233,6 +231,6 @@
         host = context.plone_utils.getMailHost()
         try:
-            host.secureSend(msg, user_email, admin_email, subject = subject,
-                            subtype = 'plain', debug = False, charset = charset)
+            host.secureSend(msg, user_email, admin_email, subject=subject,
+                            subtype='plain', debug=False, charset=charset)
         except (smtplib.SMTPRecipientsRefused,smtplib.SMTPServerDisconnected):
             setStatusMsg(None, context,
