Changeset 17530
- Timestamp:
- Sep 26, 2019, 8:53:37 AM (6 years ago)
- Location:
- snapshotplugin/0.12
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
snapshotplugin/0.12/COPYING
r12704 r17530 1 Copyright (C) 2012-2013 MATOBA Akihiro <matobaa+trac-hacks@gmail.com>1 Copyright (C) 2012-2013, 2019 MATOBA Akihiro <matobaa+trac-hacks@gmail.com> 2 2 All rights reserved. 3 3 -
snapshotplugin/0.12/setup.py
r12524 r17530 6 6 setup( 7 7 name='Snapshot', 8 version='0. 1',8 version='0.2', 9 9 license='Modified BSD', 10 10 author='MATOBA Akihiro', -
snapshotplugin/0.12/snapshot/macro.py
r16912 r17530 2 2 # -*- coding: utf-8 -*- 3 3 # 4 # Copyright (C) 2012-2013 MATOBA Akihiro <matobaa+trac-hacks@gmail.com>4 # Copyright (C) 2012-2013, 2019 MATOBA Akihiro <matobaa+trac-hacks@gmail.com> 5 5 # All rights reserved. 6 6 # … … 9 9 10 10 from genshi.builder import tag 11 from trac import __version__ as VERSION 11 12 from trac.core import Component, implements 12 13 from trac.ticket.api import TicketSystem 14 from trac.util.presentation import Paginator 13 15 from trac.util.translation import _ 14 16 from trac.web.chrome import Chrome, add_stylesheet … … 47 49 group = '' # Sentinel 48 50 groups = {} 49 lines = content.split('\ r\n')51 lines = content.split('\n') 50 52 for line in lines: 51 53 if line.startswith('||= href =||= '): … … 88 90 # 89 91 data = { 90 'paginator': None,92 'paginator': Paginator([]), 91 93 'headers': headers, 92 94 'query': query, … … 95 97 } 96 98 add_stylesheet(formatter.req, 'common/css/report.css') 97 chrome = Chrome(self.env) 98 data = chrome.populate_data(formatter.req, data) 99 template = chrome.load_template('query_results.html') 100 content = template.generate(**data) 101 # ticket id list as static 102 tickets = '' 103 if 'id' in cols: 104 ticket_id_list = [ticket.get('id') for group in groups for ticket in group[1]] 105 if len(ticket_id_list) > 0: 106 tickets = '([ticket:' + ','.join(ticket_id_list) + ' query by ticket id])' 107 return tag.div(content, format_to_html(self.env, formatter.context, tickets)) 99 100 if VERSION < '1.3.2': # Genshi 101 chrome = Chrome(self.env) 102 data = chrome.populate_data(formatter.req, data) 103 template = chrome.load_template('query_results.html') 104 content = template.generate(**data) 105 return content 106 else: # jinja2 107 return Chrome(self.env).render_fragment(formatter.req, 'query_results.html', data) 108 108 except StopIteration: 109 109 errorinfo = _('Not Enough fields in ticket: %s') % line -
snapshotplugin/0.12/snapshot/query.py
r12704 r17530 2 2 # -*- coding: utf-8 -*- 3 3 # 4 # Copyright (C) 2012-2013 MATOBA Akihiro <matobaa+trac-hacks@gmail.com>4 # Copyright (C) 2012-2013, 2019 MATOBA Akihiro <matobaa+trac-hacks@gmail.com> 5 5 # All rights reserved. 6 6 # … … 27 27 @classmethod 28 28 def formatter(self, obj): 29 return isinstance(obj, datetime) and format_datetime(obj) or str(obj)29 return isinstance(obj, datetime) and format_datetime(obj) or unicode(obj) 30 30 31 31 #ITemplateStreamFilter methods … … 54 54 ' || '.join([self.formatter(ticket[col]) for col in cols])) 55 55 text += '}}}' 56 if 'id' in cols: 57 ticket_id_list = [str(ticket['id']) for ticket in tickets for (_, tickets) in data['groups']] 58 if len(ticket_id_list) > 0: 59 text += '\n([ticket:' + ','.join(ticket_id_list) + ' query by ticket id])' 56 60 div = tag.div(tag.input(value='Save as wiki:', type='submit'), 57 61 tag.input(name='action', value='edit', type='hidden'), … … 93 97 cols_work[cols_work.index('ticket')] = 'id' # replace 'ticket' to 'id' 94 98 text += '||= href =||= %s\n' % ' =||= '.join(cols_work) 99 ticket_id_list = [] 95 100 for groupindex, row_group in data.get('row_groups', []): 96 101 text += '|| group: %s\n' % groupindex … … 103 108 text += '|| %s || %s\n' % (ticket['href'], 104 109 ' || '.join([self.formatter(col, ticket[col]) for col in cols])) 110 if 'ticket' in ticket: 111 ticket_id_list.append(ticket['ticket']) 105 112 text += '}}}' 113 if len(ticket_id_list) > 0: 114 text += '\n([ticket:' + ','.join(ticket_id_list) + ' query by ticket id])' 106 115 div = tag.div(tag.input(value='Save as wiki:', type='submit'), 107 116 tag.input(name='action', value='edit', type='hidden'),
Note: See TracChangeset
for help on using the changeset viewer.