mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
missed a bit of refactoring
This commit is contained in:
parent
dd00ff69aa
commit
5b7c105c5f
@ -12,7 +12,7 @@ import troggle.settings as settings
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from .auth import login_required_if_public
|
||||
|
||||
from troggle.lib import version_control
|
||||
from troggle.core.utils import write_and_commit, WriteAndCommitError
|
||||
|
||||
MAX_IMAGE_WIDTH = 1000
|
||||
MAX_IMAGE_HEIGHT = 800
|
||||
@ -87,11 +87,11 @@ def new_image_form(request, path):
|
||||
full_path.parent.mkdir(parents=False, exist_ok=True)
|
||||
try:
|
||||
change_message = form.cleaned_data["change_message"]
|
||||
version_control.write_and_commit([(desc_path, image_page, "utf-8"),
|
||||
write_and_commit([(desc_path, image_page, "utf-8"),
|
||||
(image_path, ib.getbuffer(), False),
|
||||
(thumb_path, tb.getbuffer(), False)],
|
||||
f'{change_message} - online adding of an image')
|
||||
except version_control.WriteAndCommitError as e:
|
||||
except WriteAndCommitError as e:
|
||||
return JsonResponse({"error": e.message})
|
||||
linked_image_template = loader.get_template('linked_image_template.html')
|
||||
html_snippet = linked_image_template.render({'thumbnail_url': f'/{thumb_rel_path}', 'page_url': f'/{desc_rel_path}'}, request)
|
||||
|
Loading…
Reference in New Issue
Block a user