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.
This commit is contained in:
Brett Smith 2020-04-28 10:48:10 -04:00
parent 694630ca02
commit e79877ee6a
3 changed files with 4 additions and 3 deletions

View file

@ -56,6 +56,7 @@ LINK_METADATA = frozenset([
'invoice',
'purchase-order',
'receipt',
'rt-id',
'statement',
])

View file

@ -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:

View file

@ -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: