accrual: Outgoing report doesn't put RT web links in < >.

The RT web interface doesn't handle angle brackets well, making the
`>` part of the link.
This commit is contained in:
Brett Smith 2020-05-18 17:04:28 -04:00
parent b142e8fc31
commit 47235f694c
3 changed files with 6 additions and 8 deletions

View file

@ -230,7 +230,7 @@ def outgoing_report(groups: PostGroups,
contract_links = related.all_meta_links('contract')
if contract_links:
contract_s = ' , '.join(rt_wrapper.iter_urls(
contract_links, '<{}>', '{}', '<BROKEN RT LINK: {}>',
contract_links, missing_fmt='<BROKEN RT LINK: {}>',
))
else:
contract_s = "NO CONTRACT GOVERNS THIS TRANSACTION"
@ -254,7 +254,7 @@ def outgoing_report(groups: PostGroups,
txn = post.meta.txn
if txn is not last_txn:
last_txn = txn
txn = rt_wrapper.txn_with_urls(txn)
txn = rt_wrapper.txn_with_urls(txn, '{}')
bc_printer.print_entry(txn, file=out_file)
def filter_search(postings: Iterable[data.Posting],

View file

@ -5,7 +5,7 @@ from setuptools import setup
setup(
name='conservancy_beancount',
description="Plugin, library, and reports for reading Conservancy's books",
version='1.0.4',
version='1.0.5',
author='Software Freedom Conservancy',
author_email='info@sfconservancy.org',
license='GNU AGPLv3+',

View file

@ -305,8 +305,9 @@ def test_outgoing_report(accrual_postings):
accrual.outgoing_report({invoice: related}, output, errors, rt_client, rt_cache)
assert not errors.getvalue()
rt_url = rt_client.DEFAULT_URL[:-9]
rt_id_url = re.escape(f'<{rt_url}Ticket/Display.html?id=510>')
contract_url = re.escape(f'<{rt_url}Ticket/Attachment/4000/4000/contract.pdf>')
rt_id_url = rf'\b{re.escape(f"{rt_url}Ticket/Display.html?id=510")}\b'
contract_url = rf'\b{re.escape(f"{rt_url}Ticket/Attachment/4000/4000/contract.pdf")}\b'
print(output.getvalue())
check_output(output, [
r'^PAYMENT FOR APPROVAL:$',
r'^REQUESTOR: Mx\. 510 <mx510@example\.org>$',
@ -338,9 +339,6 @@ def test_outgoing_report_custom_field_fallbacks(accrual_postings):
rt_cache = rtutil.RT(rt_client)
accrual.outgoing_report({invoice: related}, output, errors, rt_client, rt_cache)
assert not errors.getvalue()
rt_url = rt_client.DEFAULT_URL[:-9]
rt_id_url = re.escape(f'<{rt_url}Ticket/Display.html?id=510>')
contract_url = re.escape(f'<{rt_url}Ticket/Attachment/4000/4000/contract.pdf>')
check_output(output, [
r'^PAYMENT FOR APPROVAL:$',
r'^REQUESTOR: <mx510@example\.org>$',