Index: qPloneComments/trunk/patch.py
===================================================================
--- qPloneComments/trunk/patch.py	(revision 3713)
+++ qPloneComments/trunk/patch.py	(revision 1)
@@ -1,46 +1,46 @@
+from Products.CMFDefault.DiscussionItem import DiscussionItemContainer, DiscussionItem
+from AccessControl import getSecurityManager, Unauthorized
 from DateTime import DateTime
+from Products.CMFCore.utils import getToolByName
+from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
-from AccessControl import Unauthorized
-from AccessControl import getSecurityManager
-from Products.CMFCore.utils import getToolByName
-from Products.CMFDefault.DiscussionItem import DiscussionItem
-from Products.CMFDefault.DiscussionItem import DiscussionItemContainer
 
-from Products.qPloneComments.utils import getProp
+from utils import *
 
-# Patching createReply method of
+# Patching createReply method of 
 # Products.CMFDefault.DiscussionItem.DiscussionItemContainer
-def createReply(self, title, text, Creator=None, email=''):
-    """Create a reply in the proper place.
+def createReply( self, title, text, Creator=None, email=''):
+    """
+        Create a reply in the proper place
     """
     container = self._container
 
     id = int(DateTime().timeTime())
-    while self._container.get(str(id), None) is not None:
-        id += 1
-    id = str(id)
+    while self._container.get( str(id), None ) is not None:
+        id = id + 1
+    id = str( id )
 
-    item = DiscussionItem(id, title=title, description=title)
+    item = DiscussionItem( id, title=title, description=title )
+    item._edit( text_format='structured-text', text=text )
 
     if Creator:
-        if getattr(item, 'addCreator', None) is not None:
+        if hasattr(item, 'addCreator'):
             item.addCreator(Creator)
         else:
             item.creator = Creator
 
-    self._container[id] = item
-    item = item.__of__(self)
+    pm = getToolByName(self, 'portal_membership')
 
-    item.setFormat('structured-text')
-    item._edit(text)
-
-    pm = getToolByName(self, 'portal_membership')
     if pm.isAnonymousUser():
         item.manage_addProperty(id='email', value=email, type='string')
 
-    item.review_state = 'private'
+    item.review_state="private"
+
+    item.setReplyTo( self._getDiscussable() )
+    self._container[ id ] = item
 
     # Control of performing moderation
-    if getProp(self, 'enable_moderation', marker=False):
+    ifModerate = getProp(self, "enable_moderation", marker=False)
+    if ifModerate:
         roles = [role['name'] for role in self.acl_users.rolesOfPermission('Moderate Discussion')
                  if role['selected']== 'SELECTED']
@@ -49,24 +49,25 @@
         item.manage_permission('View', roles, acquire=0)
     else:
-        item.review_state = 'published'
+        item.review_state = "published"
 
-    item.setReplyTo(self._getDiscussable())
-    item.indexObject()
-
+    item.__of__( self ).indexObject()
     return id
 
 def getReplies( self ):
-    """Return a sequence of the DiscussionResponse objects which are
-       associated with this Discussable.
     """
+        Return a sequence of the DiscussionResponse objects which are
+        associated with this Discussable
+    """
+
     objects = []
+    a = objects.append
     validate = getSecurityManager().validate
 
     result_ids = self._getReplyResults()
     for id in result_ids:
-        comment = self._container.get(id).__of__(self)
+        object = self._container.get( id ).__of__( self )
         try:
-            if validate(self, self, id, comment):
-                objects.append(comment)
+            if validate(self, self, id, object):
+                a( object )
         except Unauthorized:
             pass
@@ -79,6 +80,6 @@
     funcs = item[1]
     if 'deleteReply' in funcs:
-        new_perms.append((perm_name, [f for f in funcs if f != 'deleteReply']))
-        new_perms.append(('Moderate Discussion', ('deleteReply',)))
+        new_perms.append( (perm_name, [f for f in funcs if f != 'deleteReply']) )
+        new_perms.append( ('Moderate Discussion', ('deleteReply', )) )
     else:
         new_perms.append(item)
