def test_getLink_caching_target(self): """Cache takes the 'target' parameter into account.""" adapted = IPrettyLink(self.folder) self.assertEqual(adapted.target, '_self') self.assertTrue(u" target='_self'>" in adapted.getLink()) adapted.target = '_blank' self.assertFalse(u" target='_self'>" in adapted.getLink()) self.assertTrue(u" target='_blank'>" in adapted.getLink())
def test_getLink_caching_target(self): """Cache takes the 'target' parameter into account.""" adapted = IPrettyLink(self.folder) self.assertEqual(adapted.target, '_self') self.assertTrue(u" target='_self'>" in adapted.getLink()) adapted.target = '_blank' self.assertFalse(u" target='_self'>" in adapted.getLink()) self.assertTrue(u" target='_blank'>" in adapted.getLink())
def renderCell(self, item): """ """ obj = self._getObject(item) prettyLinker = IPrettyLink(obj) prettyLinker.target = '_parent' prettyLinker.showContentIcon = True annexes = staticInfos = moreInfos = '' tool = api.portal.get_tool('portal_plonemeeting') cfg = tool.getMeetingConfig(self.context) if obj.meta_type == 'MeetingItem': isPrivacyViewable = obj.adapted().isPrivacyViewable() prettyLinker.isViewable = isPrivacyViewable # display annexes and infos if item and item isPrivacyViewable if isPrivacyViewable: # display moreInfos about item # visible columns are one define for items listings or when the meeting is displayed # so check where we are if IMeeting.providedBy(self.context): # on the meeting if displaying_available_items(self.context): visibleColumns = cfg.getAvailableItemsListVisibleColumns( ) else: visibleColumns = cfg.getItemsListVisibleColumns() else: visibleColumns = cfg.getItemColumns() staticInfos = obj.restrictedTraverse('@@static-infos')( visibleColumns=visibleColumns) if self.showMoreInfos: moreInfos = obj.restrictedTraverse('@@item-more-infos')( visibleColumns=visibleColumns) # display annexes annexes = render_item_annexes(obj, tool) elif obj.getTagName() == 'Meeting': visibleColumns = cfg.getMeetingColumns() staticInfos = obj.restrictedTraverse('@@static-infos')( visibleColumns=visibleColumns) # check_can_view=True because permission check is not enough annexes += obj.restrictedTraverse('@@categorized-childs')( portal_type='annex', check_can_view=True) # display number of items in meeting title contentValue = "{0} [{1}]".format(obj.Title(), obj.number_of_items()) prettyLinker.contentValue = contentValue if annexes: annexes = u"<div class='dashboard_annexes'>{0}</div>".format( annexes) pretty_link = prettyLinker.getLink() return pretty_link + staticInfos + moreInfos + annexes