Refactors get_or_create_book

This commit is contained in:
Mouse Reeve
2020-05-10 12:56:59 -07:00
parent 2a98093ebe
commit 2ef87c2131
9 changed files with 258 additions and 280 deletions

View File

@ -4,7 +4,7 @@ from requests import HTTPError
import importlib
from urllib.parse import urlparse
from fedireads import models
from fedireads import models, settings
from fedireads.tasks import app
@ -69,6 +69,10 @@ def get_by_absolute_id(absolute_id, model):
except model.DoesNotExist:
pass
url = urlparse(absolute_id)
if url.netloc != settings.DOMAIN:
return None
# try finding a local status with that id
local_id = absolute_id.split('/')[-1]
try: