def detail_view(self, req, cat, page, link): links_configuration = LinksConfiguration(self.env) (source, target) = links_configuration.extract_types(link) copy_fields = [f.strip() for f in self.links.get('%s.%s.%s' % \ (source, target, LinkOption.COPY), default='').split(',')] show_fields = [f.strip() for f in self.links.get('%s.%s.%s' % \ (source, target, LinkOption.SHOW), default='').split(',')] ticket_system = AgiloTicketSystem(self.env) # dict of name->label for all core and custom fields labels = dict([(f['name'], f['label']) for f in ticket_system.get_ticket_fields()]) cascade_delete = source + '-' + target in self._get_delete_pairs() data = { 'view': 'detail', 'link': link, 'source': source, 'target': target, 'source_fields': self.config.TYPES[source], 'target_fields': self.config.TYPES[target], 'labels': labels, 'copy_fields': copy_fields, 'show_fields': show_fields, 'cascade_delete': cascade_delete } return 'agilo_admin_links.html', data
def detail_view(self, req, cat, page, link): links_configuration = LinksConfiguration(self.env) (source, target) = links_configuration.extract_types(link) copy_fields = [f.strip() for f in self.links.get('%s.%s.%s' % \ (source, target, LinkOption.COPY), default='').split(',')] show_fields = [f.strip() for f in self.links.get('%s.%s.%s' % \ (source, target, LinkOption.SHOW), default='').split(',')] ticket_system = AgiloTicketSystem(self.env) # dict of name->label for all core and custom fields labels = dict([(f['name'], f['label']) for f in ticket_system.get_ticket_fields()]) cascade_delete = source+'-'+target in self._get_delete_pairs() data = { 'view': 'detail', 'link': link, 'source' : source, 'target' : target, 'source_fields' : self.config.TYPES[source], 'target_fields' : self.config.TYPES[target], 'labels' : labels, 'copy_fields' : copy_fields, 'show_fields' : show_fields, 'cascade_delete': cascade_delete } return 'agilo_admin_links.html', data
def test_fields_for_task(self): """Tests how the FieldsWrapper respond with a task type""" ticket_system = AgiloTicketSystem(self.env) tfw = FieldsWrapper(self.env, ticket_system.get_ticket_fields(), Type.TASK) expected_fields_for_task = AgiloConfig(self.env).TYPES.get(Type.TASK) # Try to check the keys field_wrapper_names = map(lambda field: field[Key.NAME], tfw) # it is added by the ticket system to store sprint # scope synchronous with milestone field_wrapper_names.remove(Key.MILESTONE) expected_fields_for_task.remove('id') if not ticket_system.is_trac_012(): # in Trac 0.11, time fields are magic field_wrapper_names.append('changetime') field_wrapper_names.append('time') self.assert_equals(sorted(expected_fields_for_task), sorted(field_wrapper_names))