コード例 #1
0
ファイル: test_comments.py プロジェクト: CGTIC/Plone_SP
 def test_viewing_uncommented_item_doesnt_create_talkback(self):
     # make sure we avoid creating unnecessary persistent talkbacks
     self.assertFalse(hasattr(self.portal.document, 'talkback'))
     viewlet = CommentsViewlet(self.portal.document, self.app.REQUEST, None, None)
     viewlet.update()
     viewlet.render()
     self.assertFalse(hasattr(self.portal.document, 'talkback'))
コード例 #2
0
 def test_viewing_uncommented_item_doesnt_create_talkback(self):
     # make sure we avoid creating unnecessary persistent talkbacks
     self.assertFalse(hasattr(self.portal.document, 'talkback'))
     viewlet = CommentsViewlet(self.portal.document, self.app.REQUEST, None,
                               None)
     viewlet.update()
     viewlet.render()
     self.assertFalse(hasattr(self.portal.document, 'talkback'))
コード例 #3
0
ファイル: test_comments.py プロジェクト: CGTIC/Plone_SP
    def test_time_render(self):
        request = self.app.REQUEST
        context = self.portal.document
        dtool = getToolByName(context, 'portal_discussion')
        tb = dtool.getDiscussionFor(context)
        reply_id = tb.createReply(title='Subject', text='Reply text', Creator='tester')

        viewlet = CommentsViewlet(context, request, None, None)
        viewlet.update()
        time = DateTime('2009/10/20 15:00')
        self.assertEqual(viewlet.format_time(time), 'Oct 20, 2009 03:00 PM')
コード例 #4
0
    def test_time_render(self):
        request = self.app.REQUEST
        context = self.portal.document
        dtool = getToolByName(context, 'portal_discussion')
        tb = dtool.getDiscussionFor(context)
        reply_id = tb.createReply(title='Subject',
                                  text='Reply text',
                                  Creator='tester')

        viewlet = CommentsViewlet(context, request, None, None)
        viewlet.update()
        time = DateTime('2009/10/20 15:00')
        self.assertEqual(viewlet.format_time(time), 'Oct 20, 2009 03:00 PM')
コード例 #5
0
 def update(self):
     BaseClass.update(self)
     self.lastcommentid = '0'
     self.lasttimestamp = self.getlastchangedate()
     
     if self.request.has_key('comcynapsecyninnewcommentsubmit'):
         #A new comment was submitted
         if self.request.has_key('comcynapsecyninNewCommentSubject') and self.request.has_key('comcynapsecyninNewCommentBody') and self.request.has_key('comcynapsecynincontextUID'):
             cont_uid = self.request['comcynapsecynincontextUID'];
             query = {'UID':cont_uid}
             pdt = self.portal_discussion
             cat = getToolByName(self.context, 'uid_catalog')
             resbrains = cat.searchResults(query)
             if len(resbrains) == 1:
                 contobj = resbrains[0].getObject()
                 if contobj.isDiscussable() and self.canreply(contobj) > 0:
                     dobj = pdt.getDiscussionFor(contobj)
                     id = dobj.createReply(title="", text=self.request['comcynapsecyninNewCommentBody'], Creator=self.current_user())
                     reply = dobj.getReply(id)
                     if reply <> None:
                         from ubify.cyninv2theme import triggerAddOnDiscussionItem
                         triggerAddOnDiscussionItem(reply)
         else:
             return
コード例 #6
0
ファイル: test_comments.py プロジェクト: CGTIC/Plone_SP
 def _comment_login_url(self):
     viewlet = CommentsViewlet(self.portal.document, self.app.REQUEST, None, None)
     viewlet.update()
     return viewlet.login_url()
コード例 #7
0
 def _comment_login_url(self):
     viewlet = CommentsViewlet(self.portal.document, self.app.REQUEST, None,
                               None)
     viewlet.update()
     return viewlet.login_url()