Right now the href vs link thing is causing a bunch of weird behavior and also the caching on it could be a lot better.
Possible refactoring:
entries.Entry.get_targets returns a list of (url,href) pairs (looks like it already does this but the naming is confusing)
webmentions.get_target only takes (and caches) the url value
webmentions.Target.__init__ stores the self.canonical value from the request.url response
webmentions.Target._get_endpoint can override self.canonical if the document provides a <link rel="canonical">
webmentions.Target.send takes source,href parameters, and emits a compatibility warning if href != self.canonical (but only if self.endpoint is not None).
Right now the href vs link thing is causing a bunch of weird behavior and also the caching on it could be a lot better.
Possible refactoring:
entries.Entry.get_targets
returns a list of(url,href)
pairs (looks like it already does this but the naming is confusing)webmentions.get_target
only takes (and caches) theurl
valuewebmentions.Target.__init__
stores theself.canonical
value from therequest.url
responsewebmentions.Target._get_endpoint
can overrideself.canonical
if the document provides a<link rel="canonical">
webmentions.Target.send
takessource,href
parameters, and emits a compatibility warning ifhref != self.canonical
(but only ifself.endpoint is not None
).