diff --git a/sourcing/model.py b/sourcing/model.py index 341d8f7..57ee772 100644 --- a/sourcing/model.py +++ b/sourcing/model.py @@ -169,7 +169,7 @@ class Item(TimeStampedModel): @classmethod def from_external(cls, url): home = url_for('.home', _external=True) - if not url.startswith(home): + if url.startswith(home): username, _, hashid = url[len(home):].partition('/') else: m = re_server_url.match(url) @@ -209,7 +209,10 @@ class XanaLink(Item): if item in titles: return parsed['type'] + " link for " + item.title(titles=titles) - return parsed['type'] + " link: " + self.hashid + if parsed['type']: + return parsed['type'] + " link: " + self.hashid + else: + return "link: " + self.hashid @classmethod def get_all_titles(cls):