Changeset 3116 in products for quintagroup.plonecomments/trunk
- Timestamp:
- Apr 14, 2011 5:26:23 PM (13 years ago)
- Location:
- quintagroup.plonecomments/trunk/quintagroup/plonecomments
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonecomments/trunk/quintagroup/plonecomments/browser/comments.py
r3115 r3116 104 104 class CommentsKSS(PloneKSSView): 105 105 """ Operations on the report abuse form using KSS. 106 """ 106 """ 107 107 108 108 def submit_abuse_report(self): -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/patch.py
r3115 r3116 10 10 from Products.CMFDefault.DiscussionItem import DiscussionItem 11 11 from Products.CMFDefault.DiscussionItem import DiscussionItemContainer 12 from quintagroup.plonecomments.utils import getProp 12 13 13 from quintagroup.plonecomments.utils import getProp14 14 15 15 def createReply(self, title, text, Creator=None, email=''): -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/setuphandlers.py
r3115 r3116 22 22 if not 'DiscussionManager' in existing: 23 23 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.') 25 26 26 27 # Remove workflow-chain for Discussion Item -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsCommenting.py
r3115 r3116 73 73 "Anonymous user CAN'T really add comment in terned ON *Anonymous commenting mode*.") 74 74 75 76 75 def testAddCommentToDocNotAnonymUsers(self): 77 76 … … 105 104 self.like_anonym = [u for u in all_users_id if u not in self.not_like_anonym] 106 105 107 108 106 def testAddCommentToDocLikeAnonymUsers(self): 109 107 … … 129 127 "%s user(s) CAN really add comment in terned OFF " 130 128 "*Anonymous commenting mode*." % failed_users) 131 132 129 133 130 def testAddCommentToDocNotLikeAnonymUsers(self): … … 306 303 "text of reply to '%s'" % self.doc_moder_off_id) 307 304 308 309 305 def testAddCommentToReplyAllowableUsers(self): 310 306 … … 329 325 if not disparity: 330 326 failed_users.append(u) 331 self.failIf(failed_users 327 self.failIf(failed_users, 332 328 "%s - member(s) CAN'T really ADD comment in terned off" 333 329 " comments Moderation mode." % failed_users) 334 335 330 336 331 def testAddCommentToReplyIllegalUsers(self): -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsConfiglet.py
r3115 r3116 76 76 self.failUnless('Anonymous' in actual_reply_permission, \ 77 77 "'Reply to Item' permission set for %s. 'Anonymous' " 78 "role NOT added" % 78 "role NOT added" % actual_reply_permission) 79 79 # Simulate switching OFF Anonymous Commenting 80 80 if 'enable_anonymous_commenting' in self.request.form: … … 84 84 self.failIf('Anonymous' in actual_reply_permission, \ 85 85 "'Reply to Item' permission set for %s. 'Anonymous' role " 86 "NOT erased" % 86 "NOT erased" % actual_reply_permission) 87 87 88 88 def testSwitchONModeration(self): … … 141 141 142 142 # 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'] 145 145 self.portal.prefs_comments_setup() 146 146 self.failUnless(self.prefs.getProperty('enable_approve_notification')==0, … … 155 155 156 156 # 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'] 159 159 self.portal.prefs_comments_setup() 160 160 self.failUnless(self.prefs.getProperty('enable_published_notification')==0, -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotificationRecipients.py
r3114 r3116 11 11 from quintagroup.plonecomments.tests.config import PROPERTY_SHEET 12 12 13 USERS = { # Common Members13 USERS = { # Common Members 14 14 'admin':{'passw': 'secret_admin', 'roles': ['Manager']}, 15 15 'owner':{'passw': 'secret_creator', 'roles': ['Member']}, 16 16 'replier1':{'passw': 'secret_member', 'roles': ['Member']}, 17 17 'replier2':{'passw': 'secret_member', 'roles': ['Member']}, 18 # Members for discussion manager group18 # Members for discussion manager group 19 19 'dm_admin':{'passw': 'secret_dm_admin', 'roles': ['Manager']}, 20 20 } … … 92 92 def test_Reply(self): 93 93 self.portal.MailHost.reset() 94 95 94 self.prepareRequest4Reply('replier1') 96 95 self.my_doc.discussion_reply('A Reply for my_doc' ,'text of reply for my_doc') 97 98 96 mails = self.portal.MailHost.messages 99 97 self.assertEqual(len(mails), 1) … … 107 105 reply = self.discussion.getDiscussionFor(self.my_doc).getReplies()[0] 108 106 self.portal.MailHost.reset() 109 110 111 107 reply.discussion_publish_comment() 112 108 mails = self.portal.MailHost.messages … … 126 122 reply2 = self.discussion.getDiscussionFor(reply).getReplies()[0] 127 123 self.portal.MailHost.reset() 128 129 130 124 reply2.discussion_publish_comment() 131 125 mails = self.portal.MailHost.messages … … 141 135 reply = self.discussion.getDiscussionFor(self.my_doc).getReplies()[0] 142 136 self.portal.MailHost.reset() 143 144 145 137 reply.deleteDiscussion() 146 138 mails = self.portal.MailHost.messages -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/utils.py
r3115 r3116 83 83 email = obj.getProperty('email', None) 84 84 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(), ] 86 87 userid = creators and creators[0] or "" 87 88 creator = getToolByName(context, 'portal_membership').getMemberById(userid) … … 126 127 if user_email: 127 128 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} 133 134 else: 134 135 args = {} … … 141 142 if user_email: 142 143 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} 148 149 else: 149 150 args = {} … … 159 160 user_email = getEmail(di_parrent, context) 160 161 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]} 166 167 else: 167 168 args = {} … … 173 174 user_email = getParentOwnerEmail(reply, context) 174 175 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} 179 180 subject = translate(_(u"published_notification_subject", 180 181 default=u"[${organization_name}] New comment added", … … 188 189 user_email = getProp(context, "email_discussion_manager", None) 189 190 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} 194 195 subject = translate(_(u"approve_notification_subject", 195 196 default=u"[${organization_name}] New comment awaits moderation",
Note: See TracChangeset
for help on using the changeset viewer.