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:
parent
694630ca02
commit
e79877ee6a
3 changed files with 4 additions and 3 deletions
|
@ -56,6 +56,7 @@ LINK_METADATA = frozenset([
|
||||||
'invoice',
|
'invoice',
|
||||||
'purchase-order',
|
'purchase-order',
|
||||||
'receipt',
|
'receipt',
|
||||||
|
'rt-id',
|
||||||
'statement',
|
'statement',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ from typing import (
|
||||||
|
|
||||||
class MetaRepoLinks(core.TransactionHook):
|
class MetaRepoLinks(core.TransactionHook):
|
||||||
HOOK_GROUPS = frozenset(['linkcheck'])
|
HOOK_GROUPS = frozenset(['linkcheck'])
|
||||||
|
LINK_METADATA = data.LINK_METADATA.difference('rt-id')
|
||||||
PATH_PUNCT_RE = re.compile(r'[:/]')
|
PATH_PUNCT_RE = re.compile(r'[:/]')
|
||||||
|
|
||||||
def __init__(self, config: configmod.Config) -> None:
|
def __init__(self, config: configmod.Config) -> None:
|
||||||
|
@ -48,7 +49,7 @@ class MetaRepoLinks(core.TransactionHook):
|
||||||
post: Optional[Posting]=None,
|
post: Optional[Posting]=None,
|
||||||
) -> errormod.Iter:
|
) -> errormod.Iter:
|
||||||
metadata = data.Metadata(meta)
|
metadata = data.Metadata(meta)
|
||||||
for key in data.LINK_METADATA:
|
for key in self.LINK_METADATA:
|
||||||
try:
|
try:
|
||||||
links = metadata.get_links(key)
|
links = metadata.get_links(key)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
|
|
@ -32,7 +32,6 @@ from typing import (
|
||||||
|
|
||||||
class MetaRTLinks(core.TransactionHook):
|
class MetaRTLinks(core.TransactionHook):
|
||||||
HOOK_GROUPS = frozenset(['linkcheck', 'network', 'rt'])
|
HOOK_GROUPS = frozenset(['linkcheck', 'network', 'rt'])
|
||||||
LINK_METADATA = data.LINK_METADATA.union(['rt-id'])
|
|
||||||
|
|
||||||
def __init__(self, config: configmod.Config) -> None:
|
def __init__(self, config: configmod.Config) -> None:
|
||||||
rt_wrapper = config.rt_wrapper()
|
rt_wrapper = config.rt_wrapper()
|
||||||
|
@ -46,7 +45,7 @@ class MetaRTLinks(core.TransactionHook):
|
||||||
post: Optional[Posting]=None,
|
post: Optional[Posting]=None,
|
||||||
) -> errormod.Iter:
|
) -> errormod.Iter:
|
||||||
metadata = data.Metadata(meta)
|
metadata = data.Metadata(meta)
|
||||||
for key in self.LINK_METADATA:
|
for key in data.LINK_METADATA:
|
||||||
try:
|
try:
|
||||||
links = metadata.get_links(key)
|
links = metadata.get_links(key)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
|
Loading…
Reference in a new issue