Changeset - e79877ee6a3f
[Not reviewed]
0 3 0
Brett Smith - 4 years ago 2020-04-28 14:48:10
brettcsmith@brettcsmith.org
data: Add rt-id to LINK_METADATA.

This gets closer to our real intentions: anything that checks link
metadata should check rt-id. MetaRepoLinks is the exception, not
the rule, in ignoring rt-id.
3 files changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/data.py
Show inline comments
...
 
@@ -56,6 +56,7 @@ LINK_METADATA = frozenset([
 
    'invoice',
 
    'purchase-order',
 
    'receipt',
 
    'rt-id',
 
    'statement',
 
])
 

	
conservancy_beancount/plugin/meta_repo_links.py
Show inline comments
...
 
@@ -34,6 +34,7 @@ from typing import (
 

	
 
class MetaRepoLinks(core.TransactionHook):
 
    HOOK_GROUPS = frozenset(['linkcheck'])
 
    LINK_METADATA = data.LINK_METADATA.difference('rt-id')
 
    PATH_PUNCT_RE = re.compile(r'[:/]')
 

	
 
    def __init__(self, config: configmod.Config) -> None:
...
 
@@ -48,7 +49,7 @@ class MetaRepoLinks(core.TransactionHook):
 
                     post: Optional[Posting]=None,
 
    ) -> errormod.Iter:
 
        metadata = data.Metadata(meta)
 
        for key in data.LINK_METADATA:
 
        for key in self.LINK_METADATA:
 
            try:
 
                links = metadata.get_links(key)
 
            except TypeError:
conservancy_beancount/plugin/meta_rt_links.py
Show inline comments
...
 
@@ -32,7 +32,6 @@ from typing import (
 

	
 
class MetaRTLinks(core.TransactionHook):
 
    HOOK_GROUPS = frozenset(['linkcheck', 'network', 'rt'])
 
    LINK_METADATA = data.LINK_METADATA.union(['rt-id'])
 

	
 
    def __init__(self, config: configmod.Config) -> None:
 
        rt_wrapper = config.rt_wrapper()
...
 
@@ -46,7 +45,7 @@ class MetaRTLinks(core.TransactionHook):
 
                     post: Optional[Posting]=None,
 
    ) -> errormod.Iter:
 
        metadata = data.Metadata(meta)
 
        for key in self.LINK_METADATA:
 
        for key in data.LINK_METADATA:
 
            try:
 
                links = metadata.get_links(key)
 
            except TypeError:
0 comments (0 inline, 0 general)