Author: rjollos Date: Thu Feb 20 11:35:42 2014 New Revision: 1570152 URL: http://svn.apache.org/r1570152 Log: 0.8dev: Intraproduct ticket relation would result in an error when rendering the resource links because the proper envirionment was not being used. Refs #750.
Patch by Anze. Modified: bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py Modified: bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html?rev=1570152&r1=1570151&r2=1570152&view=diff ============================================================================== --- bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html (original) +++ bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html Thu Feb 20 11:35:42 2014 @@ -48,7 +48,7 @@ </a> </td> <td><a href="${item['desthref']}" class="${classes(item['destticket'].status, 'ticket')}"> - ${shortname_of(item['destticket'].resource)}</a> - ${summary_of(item['destticket'].resource)} + ${get_resource_shortname(item['destticket'].env, item['destticket'].resource)}</a> - ${get_resource_summary(item['destticket'].env, item['destticket'].resource)} </td> <td>$item.comment</td> <td>$item.author</td> Modified: bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html?rev=1570152&r1=1570151&r2=1570152&view=diff ============================================================================== --- bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html (original) +++ bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html Thu Feb 20 11:35:42 2014 @@ -105,7 +105,7 @@ </a> </td> <td><a href="${item['desthref']}" class="${classes(item['destticket'].status, 'ticket')}"> - ${shortname_of(item['destticket'].resource)}</a> - ${summary_of(item['destticket'].resource)} + ${get_resource_shortname(item['destticket'].env, item['destticket'].resource)}</a> - ${get_resource_summary(item['destticket'].env, item['destticket'].resource)} </td> <td>$item.comment</td> <td>$item.author</td> Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py?rev=1570152&r1=1570151&r2=1570152&view=diff ============================================================================== --- bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py (original) +++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py Thu Feb 20 11:35:42 2014 @@ -1,3 +1,4 @@ +#!/usr/bin/env python # -*- coding: UTF-8 -*- # Licensed to the Apache Software Foundation (ASF) under one @@ -16,21 +17,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - import unittest +from bhrelations.api import ResourceIdSerializer +from bhrelations.web_ui import RelationManagementModule +from bhrelations.tests.base import BaseRelationsTestCase +from multiproduct.ticket.web_ui import TicketModule from trac.ticket import Ticket from trac.util.datefmt import to_utimestamp from trac.web import RequestDone -from multiproduct.ticket.web_ui import TicketModule - -from bhrelations.api import ResourceIdSerializer -from bhrelations.web_ui import RelationManagementModule -from bhrelations.tests.base import BaseRelationsTestCase class RelationManagementModuleTestCase(BaseRelationsTestCase): - def setUp(self): BaseRelationsTestCase.setUp(self) ticket_id = self._insert_ticket(self.env, "Foo") @@ -103,13 +101,12 @@ class RelationManagementModuleTestCase(B raise Exception() def process_request(self): - url, data, x = \ - RelationManagementModule(self.env).process_request(self.req) + url, data, x = RelationManagementModule(self.env).process_request( + self.req) return data class ResolveTicketIntegrationTestCase(BaseRelationsTestCase): - def setUp(self): BaseRelationsTestCase.setUp(self) @@ -168,8 +165,8 @@ class ResolveTicketIntegrationTestCase(B def test_post_process_request_can_handle_none_data(self): self.req.path_info = '/source' - RelationManagementModule(self.env).post_process_request(self.req, - '', None, '') + RelationManagementModule(self.env).post_process_request( + self.req, '', None, '') def resolve_as_duplicate(self, ticket, duplicate_id): self.req.method = 'POST' @@ -222,9 +219,8 @@ class ResolveTicketIntegrationTestCase(B def suite(): test_suite = unittest.TestSuite() - test_suite.addTest(unittest.makeSuite(RelationManagementModuleTestCase)) + test_suite.addTest(unittest.makeSuite(RelationManagementModuleTestCase, 'test')) return test_suite - if __name__ == '__main__': unittest.main() Modified: bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py?rev=1570152&r1=1570151&r2=1570152&view=diff ============================================================================== --- bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py (original) +++ bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py Thu Feb 20 11:35:42 2014 @@ -27,7 +27,8 @@ Ticket relations user interface. import re from trac.core import Component, implements, TracError -from trac.resource import get_resource_url, Resource +from trac.resource import get_resource_url, Resource, \ + get_resource_shortname, get_resource_summary from trac.ticket.model import Ticket from trac.util import exception_to_unicode, to_unicode from trac.web import IRequestHandler, IRequestFilter @@ -127,6 +128,8 @@ class RelationManagementModule(Component 'reltypes': sorted(relsys.get_relation_types().iteritems(), key=lambda x: x[0]), 'relations': self.get_ticket_relations(ticket), + 'get_resource_shortname': get_resource_shortname, + 'get_resource_summary': get_resource_summary, }) return 'relations_manage.html', data, None Modified: bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py?rev=1570152&r1=1570151&r2=1570152&view=diff ============================================================================== --- bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py (original) +++ bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py Thu Feb 20 11:35:42 2014 @@ -24,6 +24,7 @@ r"""Project dashboard for Apache(TM) Blo Widgets displaying ticket relations. """ +from trac.resource import get_resource_shortname, get_resource_summary from trac.ticket.model import Ticket from bhdashboard.util import pretty_wrapper @@ -68,6 +69,8 @@ class TicketRelationsWidget(WidgetBase): 'ticket': ticket, 'relations': \ RelationManagementModule(self.env).get_ticket_relations(ticket), + 'get_resource_shortname': get_resource_shortname, + 'get_resource_summary': get_resource_summary, } return 'widget_relations.html', \ {'title': title, 'data': data, }, context