1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(networks): the XML editor does not overwrite a change made meanwhile

The network and filter XML editors defined what they sent as a whole, so
a page opened before another admin's change (a QoS limit, a filter rule)
saved over it and the change was gone without a word. The editor now
sends a digest of the definition it showed, and a definition changed
since is refused with a reload hint.
This commit is contained in:
catborise 2026-11-12 13:02:20 +03:00
parent 534782fdda
commit d00f7d8841
16 changed files with 151 additions and 98 deletions

View file

@ -1,4 +1,5 @@
from django.utils.translation import gettext_noop
import hashlib
import ipaddress
import secrets
import re
@ -30,6 +31,12 @@ def render(text, values, translate):
return text % {key: shown(value) for key, value in values.items()} if values else text
def digest(text):
"""A fingerprint of a definition: a page sends back the one of the
definition it showed, and a change made meanwhile is not overwritten."""
return hashlib.sha256(text.encode()).hexdigest()
class OperationError(libvirt.libvirtError):
"""An error with WebVirtCloud's own message (see message()). Its args are
the English message, for logs and the audit log; str() is the message in