本文整理汇总了Python中trac.web.chrome.Chrome.format_emails方法的典型用法代码示例。如果您正苦于以下问题:Python Chrome.format_emails方法的具体用法?Python Chrome.format_emails怎么用?Python Chrome.format_emails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.web.chrome.Chrome
的用法示例。
在下文中一共展示了Chrome.format_emails方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: in
# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import format_emails [as 别名]
# Special casing based on column name
col = col.strip('_')
if col in ('reporter', 'cc', 'owner'):
email_cells.append(cell)
elif col == 'realm':
realm = value
cell_group.append(cell)
cell_groups.append(cell_group)
resource = Resource(realm, row.get('id'))
# FIXME: for now, we still need to hardcode the realm in the action
if resource.realm.upper()+'_VIEW' not in req.perm(resource):
continue
authorized_results.append(result)
if email_cells:
for cell in email_cells:
emails = chrome.format_emails(context(resource),
cell['value'])
result[cell['index']] = cell['value'] = emails
row['resource'] = resource
if row_groups:
row_group = row_groups[-1][1]
else:
row_group = []
row_groups = [(None, row_group)]
row_group.append(row)
data.update({'header_groups': header_groups,
'row_groups': row_groups,
'numrows': numrows,
'sorting_enabled': len(row_groups) == 1})
if format == 'rss':
示例2: Resource
# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import format_emails [as 别名]
parent_realm = value
elif col == "parent_id":
parent_id = value
cell_group.append(cell)
cell_groups.append(cell_group)
if parent_realm:
resource = Resource(realm, row.get("id"), parent=Resource(parent_realm, parent_id))
else:
resource = Resource(realm, row.get("id"))
# FIXME: for now, we still need to hardcode the realm in the action
if resource.realm.upper() + "_VIEW" not in req.perm(resource):
continue
authorized_results.append(result)
if email_cells:
for cell in email_cells:
emails = chrome.format_emails(context.child(resource), cell["value"])
result[cell["index"]] = cell["value"] = emails
row["resource"] = resource
if row_groups:
row_group = row_groups[-1][1]
else:
row_group = []
row_groups = [(None, row_group)]
row_group.append(row)
data.update({"header_groups": header_groups, "row_groups": row_groups, "numrows": numrows})
if format == "rss":
data["email_map"] = chrome.get_email_map()
data["context"] = web_context(req, report_resource, absurls=True)
return "report.rss", data, "application/rss+xml"
示例3: _render_view
# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import format_emails [as 别名]
#.........这里部分代码省略.........
if col == '__group__' and value != prev_group_value:
prev_group_value = value
# Brute force handling of email in group by header
row_groups.append(
(value and chrome.format_author(req, value), []))
# Other row properties
row['__idx__'] = row_idx
if col in self._html_cols:
row[col] = value
if col in ('report', 'ticket', 'id', '_id'):
row['id'] = value
# Special casing based on column name
col = col.strip('_')
if col in ('reporter', 'cc', 'owner'):
email_cells.append(cell)
elif col == 'realm':
realm = value
elif col == 'parent_realm':
parent_realm = value
elif col == 'parent_id':
parent_id = value
cell_group.append(cell)
cell_groups.append(cell_group)
if parent_realm:
resource = Resource(realm, row.get('id'),
parent=Resource(parent_realm, parent_id))
else:
resource = Resource(realm, row.get('id'))
# FIXME: for now, we still need to hardcode the realm in the action
if resource.realm.upper()+'_VIEW' not in req.perm(resource):
continue
authorized_results.append(result)
if email_cells:
for cell in email_cells:
emails = chrome.format_emails(context.child(resource),
cell['value'])
result[cell['index']] = cell['value'] = emails
row['resource'] = resource
if row_groups:
row_group = row_groups[-1][1]
else:
row_group = []
row_groups = [(None, row_group)]
row_group.append(row)
data.update({'header_groups': header_groups,
'row_groups': row_groups,
'numrows': numrows})
if format == 'rss':
data['context'] = web_context(req, report_resource,
absurls=True)
return 'report.rss', data, 'application/rss+xml'
elif format == 'csv':
filename = 'report_%s.csv' % id if id else 'report.csv'
self._send_csv(req, cols, authorized_results, mimetype='text/csv',
filename=filename)
elif format == 'tab':
filename = 'report_%s.tsv' % id if id else 'report.tsv'
self._send_csv(req, cols, authorized_results, '\t',
mimetype='text/tab-separated-values',
filename=filename)
else:
p = page if max is not None else None
add_link(req, 'alternate',
auth_link(req, report_href(format='rss', page=None)),
_('RSS Feed'), 'application/rss+xml', 'rss')
add_link(req, 'alternate', report_href(format='csv', page=p),
_('Comma-delimited Text'), 'text/plain')
add_link(req, 'alternate', report_href(format='tab', page=p),
_('Tab-delimited Text'), 'text/plain')
if 'REPORT_SQL_VIEW' in req.perm('report', id):
add_link(req, 'alternate',
req.href.report(id=id, format='sql'),
_('SQL Query'), 'text/plain')
# reuse the session vars of the query module so that
# the query navigation links on the ticket can be used to
# navigate report results as well
try:
req.session['query_tickets'] = \
' '.join([str(int(row['id']))
for rg in row_groups for row in rg[1]])
req.session['query_href'] = \
req.session['query_href'] = report_href()
# Kludge: we have to clear the other query session
# variables, but only if the above succeeded
for var in ('query_constraints', 'query_time'):
if var in req.session:
del req.session[var]
except (ValueError, KeyError):
pass
if set(data['args']) - set(['USER']):
data['show_args_form'] = True
add_script(req, 'common/js/folding.js')
if missing_args:
add_warning(req, _(
'The following arguments are missing: %(args)s',
args=", ".join(missing_args)))
return 'report_view.html', data, None