Changeset 3116 in products for quintagroup.plonecomments/trunk


Ignore:
Timestamp:
Apr 14, 2011 5:26:23 PM (13 years ago)
Author:
kroman0
Message:

Pyflakes and pep8 fixes #3

Location:
quintagroup.plonecomments/trunk/quintagroup/plonecomments
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonecomments/trunk/quintagroup/plonecomments/browser/comments.py

    r3115 r3116  
    104104class CommentsKSS(PloneKSSView): 
    105105    """ Operations on the report abuse form using KSS. 
    106     """    
     106    """ 
    107107 
    108108    def submit_abuse_report(self): 
  • quintagroup.plonecomments/trunk/quintagroup/plonecomments/patch.py

    r3115 r3116  
    1010from Products.CMFDefault.DiscussionItem import DiscussionItem 
    1111from Products.CMFDefault.DiscussionItem import DiscussionItemContainer 
     12from quintagroup.plonecomments.utils import getProp 
    1213 
    13 from quintagroup.plonecomments.utils import getProp 
    1414 
    1515def createReply(self, title, text, Creator=None, email=''): 
  • quintagroup.plonecomments/trunk/quintagroup/plonecomments/setuphandlers.py

    r3115 r3116  
    2222    if not 'DiscussionManager' in existing: 
    2323        gtool.addGroup('DiscussionManager', roles=['DiscussionManager']) 
    24         logger.info('Added DiscussionManager group to portal_groups with DiscussionManager role.') 
     24        logger.info('Added DiscussionManager group to portal_groups with ' 
     25                    'DiscussionManager role.') 
    2526 
    2627    # Remove workflow-chain for Discussion Item 
  • quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsCommenting.py

    r3115 r3116  
    7373            "Anonymous user CAN'T really add comment in terned ON *Anonymous commenting mode*.") 
    7474 
    75  
    7675    def testAddCommentToDocNotAnonymUsers(self): 
    7776 
     
    105104        self.like_anonym = [u for u in all_users_id if u not in self.not_like_anonym] 
    106105 
    107  
    108106    def testAddCommentToDocLikeAnonymUsers(self): 
    109107 
     
    129127            "%s user(s) CAN really add comment in terned OFF " 
    130128            "*Anonymous commenting mode*." % failed_users) 
    131  
    132129 
    133130    def testAddCommentToDocNotLikeAnonymUsers(self): 
     
    306303            "text of reply to '%s'" % self.doc_moder_off_id) 
    307304 
    308  
    309305    def testAddCommentToReplyAllowableUsers(self): 
    310306 
     
    329325            if not disparity: 
    330326                failed_users.append(u) 
    331         self.failIf(failed_users , 
     327        self.failIf(failed_users, 
    332328            "%s - member(s) CAN'T really ADD comment in terned off" 
    333329            " comments Moderation mode." % failed_users) 
    334  
    335330 
    336331    def testAddCommentToReplyIllegalUsers(self): 
  • quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsConfiglet.py

    r3115 r3116  
    7676        self.failUnless('Anonymous' in actual_reply_permission, \ 
    7777            "'Reply to Item' permission set for %s. 'Anonymous' " 
    78             "role NOT added" %  actual_reply_permission) 
     78            "role NOT added" % actual_reply_permission) 
    7979        # Simulate switching OFF Anonymous Commenting 
    8080        if 'enable_anonymous_commenting' in self.request.form: 
     
    8484        self.failIf('Anonymous' in actual_reply_permission, \ 
    8585            "'Reply to Item' permission set for %s. 'Anonymous' role " 
    86             "NOT erased" %  actual_reply_permission) 
     86            "NOT erased" % actual_reply_permission) 
    8787 
    8888    def testSwitchONModeration(self): 
     
    141141 
    142142        # Check OFF Notification Anonymous Commenting 
    143         if self.request.form.has_key('enable_approve_notification'): 
    144            del self.request.form['enable_approve_notification'] 
     143        if 'enable_approve_notification' in self.request.form: 
     144            del self.request.form['enable_approve_notification'] 
    145145        self.portal.prefs_comments_setup() 
    146146        self.failUnless(self.prefs.getProperty('enable_approve_notification')==0, 
     
    155155 
    156156        # Check OFF Notification Anonymous Commenting 
    157         if self.request.form.has_key('enable_published_notification'): 
    158            del self.request.form['enable_published_notification'] 
     157        if 'enable_published_notification' in self.request.form: 
     158            del self.request.form['enable_published_notification'] 
    159159        self.portal.prefs_comments_setup() 
    160160        self.failUnless(self.prefs.getProperty('enable_published_notification')==0, 
  • quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotificationRecipients.py

    r3114 r3116  
    1111from quintagroup.plonecomments.tests.config import PROPERTY_SHEET 
    1212 
    13 USERS = {# Common Members 
     13USERS = {   # Common Members 
    1414         'admin':{'passw': 'secret_admin', 'roles': ['Manager']}, 
    1515         'owner':{'passw': 'secret_creator', 'roles': ['Member']}, 
    1616         'replier1':{'passw': 'secret_member', 'roles': ['Member']}, 
    1717         'replier2':{'passw': 'secret_member', 'roles': ['Member']}, 
    18          # Members for discussion manager group 
     18            # Members for discussion manager group 
    1919         'dm_admin':{'passw': 'secret_dm_admin', 'roles': ['Manager']}, 
    2020        } 
     
    9292    def test_Reply(self): 
    9393        self.portal.MailHost.reset() 
    94          
    9594        self.prepareRequest4Reply('replier1') 
    9695        self.my_doc.discussion_reply('A Reply for my_doc' ,'text of reply for my_doc') 
    97  
    9896        mails = self.portal.MailHost.messages 
    9997        self.assertEqual(len(mails), 1) 
     
    107105        reply = self.discussion.getDiscussionFor(self.my_doc).getReplies()[0] 
    108106        self.portal.MailHost.reset() 
    109          
    110  
    111107        reply.discussion_publish_comment() 
    112108        mails = self.portal.MailHost.messages 
     
    126122        reply2 = self.discussion.getDiscussionFor(reply).getReplies()[0] 
    127123        self.portal.MailHost.reset() 
    128          
    129  
    130124        reply2.discussion_publish_comment() 
    131125        mails = self.portal.MailHost.messages 
     
    141135        reply = self.discussion.getDiscussionFor(self.my_doc).getReplies()[0] 
    142136        self.portal.MailHost.reset() 
    143          
    144  
    145137        reply.deleteDiscussion() 
    146138        mails = self.portal.MailHost.messages 
  • quintagroup.plonecomments/trunk/quintagroup/plonecomments/utils.py

    r3115 r3116  
    8383        email = obj.getProperty('email', None) 
    8484        if email is None: 
    85             creators = hasattr(obj, 'listCreators') and obj.listCreators() or [obj.Creator(),] 
     85            creators = hasattr(obj, 'listCreators') and obj.listCreators() or \ 
     86                [obj.Creator(), ] 
    8687            userid = creators and creators[0] or "" 
    8788            creator = getToolByName(context, 'portal_membership').getMemberById(userid) 
     
    126127        if user_email: 
    127128            template = 'notify_comment_template' 
    128             args={'mto': user_email, 
    129                   'mfrom': admin_email, 
    130                   'obj': reply_parent, 
    131                   'organization_name': organization_name, 
    132                   'name': creator_name} 
     129            args = {'mto': user_email, 
     130                    'mfrom': admin_email, 
     131                    'obj': reply_parent, 
     132                    'organization_name': organization_name, 
     133                    'name': creator_name} 
    133134        else: 
    134135            args = {} 
     
    141142        if user_email: 
    142143            template = 'rejected_comment_template' 
    143             args={'mto': user_email, 
    144                   'mfrom': admin_email, 
    145                   'obj': reply_parent, 
    146                   'organization_name': organization_name, 
    147                   'name': creator_name} 
     144            args = {'mto': user_email, 
     145                    'mfrom': admin_email, 
     146                    'obj': reply_parent, 
     147                    'organization_name': organization_name, 
     148                    'name': creator_name} 
    148149        else: 
    149150            args = {} 
     
    159160            user_email = getEmail(di_parrent, context) 
    160161            if user_email: 
    161                 args={'mto': user_email, 
    162                       'mfrom': admin_email, 
    163                       'obj': reply_parent, 
    164                       'organization_name': organization_name, 
    165                       'name': di_parrent.getOwnerTuple()[1]} 
     162                args = {'mto': user_email, 
     163                        'mfrom': admin_email, 
     164                        'obj': reply_parent, 
     165                        'organization_name': organization_name, 
     166                        'name': di_parrent.getOwnerTuple()[1]} 
    166167            else: 
    167168                args = {} 
     
    173174        user_email = getParentOwnerEmail(reply, context) 
    174175        if user_email: 
    175             args={'mto':user_email, 
    176                   'mfrom':admin_email, 
    177                   'obj':reply_parent, 
    178                   'organization_name':organization_name} 
     176            args = {'mto': user_email, 
     177                    'mfrom': admin_email, 
     178                    'obj': reply_parent, 
     179                    'organization_name': organization_name} 
    179180            subject = translate(_(u"published_notification_subject", 
    180181                default=u"[${organization_name}] New comment added", 
     
    188189        user_email = getProp(context, "email_discussion_manager", None) 
    189190        if user_email: 
    190             args={'mto':user_email, 
    191                   'mfrom':admin_email, 
    192                   'obj':reply_parent, 
    193                   'organization_name':organization_name} 
     191            args = {'mto': user_email, 
     192                    'mfrom': admin_email, 
     193                    'obj': reply_parent, 
     194                    'organization_name': organization_name} 
    194195            subject = translate(_(u"approve_notification_subject", 
    195196                default=u"[${organization_name}] New comment awaits moderation", 
Note: See TracChangeset for help on using the changeset viewer.