Changeset 219
- Timestamp:
- 01/31/06 06:23:18
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneComments/trunk/skins/qplonecomments/discussion_publish_comment.py
r218 r219 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= reply=None7 ##parameters=obj=None 8 8 ##title= 9 9 ## 10 10 from Products.CMFPlone import transaction_note 11 from Products.qPloneComments.utils import publishDiscussion12 11 from Products.qPloneComments.utils import publishDiscussion, send_email 13 12 14 if replyis None:15 reply=context13 if obj is None: 14 obj=context 16 15 17 # Publish discussion item 18 publishDiscussion(context) 16 parent = obj.inReplyTo() 17 if parent is not None: 18 talkback = context.portal_discussion.getDiscussionFor(parent) 19 else: 20 talkback = parent = obj.aq_parent 19 21 20 # Send notification e-mail 22 reply = talkback.getReply( obj.getId() ) 23 publishDiscussion(reply) 24 21 25 send_notification_message = send_email(reply, container, state="published") 22 26 23 # Inform user about awaiting moderation24 27 portal_status_message='Comment+successfully+published' 25 28 qPloneComments/trunk/tests/testQPloneCommentsModeration.py
r218 r219 149 149 150 150 151 def testPublishing(self):151 def __testPublishing(self): 152 152 # Check whether perform real publishing 153 153 for u in DM_USERS_IDS: … … 165 165 self.logout() 166 166 self.assert_(getReplies(), "%s - member of DiscussionManager group NOT PUBLISH reply" % u) 167 168 169 def testPublishing(self): 170 # Check whether perform real publishing 171 # Pattern for publish button presence checking 172 pattern = re.compile('.*<input\\s*class="standalone"\\s*type="submit"\\s*value="Publish This Discussion"\\s*/>',\ 173 re.S|re.M) 174 for u in DM_USERS_IDS: 175 doc_id = "doc_%s" % u 176 doc_obj = getattr(self.portal, doc_id) 177 getReplies = self.discussion.getDiscussionFor(doc_obj).getReplies 178 # Check whether anonymous get no reply 179 self.logout() 180 self.assert_(not getReplies(), "View not published reply ALLOW for Anonymous") 181 # Login with actual (tested) user with DiscussionManager role and publish discussion 182 self.login(u) 183 self.assert_(getReplies(), "%s - member of DiscussionManager group NOT VIEW not published reply" % u) 184 getReplies()[0].discussion_publish_comment() 185 # Check if Publish button still present in document view page 186 auth = "%s:" % u 187 if not u=='anonym': 188 auth = '%s:%s' % (u,USERS[u]['passw']) 189 html = str(self.publish(self.portal.id+'/%s' % doc_id, auth)) 190 m = pattern.match(html) 191 self.assert_(not m, "Publish button present for %s - DiscussionManager role user after publishing" % u) 192 # Check whether Anonym view published reply 193 self.logout() 194 self.assert_(getReplies(), "%s - member of DiscussionManager group NOT PUBLISH reply" % u) 195 167 196 168 197
