You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code is something we use in conjunction with #1025 to prevent patching an object with outdated info:
fromdateutil.parserimportisoparsefromguillotinaimportconfigurefromguillotina.eventsimportIBeforeObjectModifiedEventfromguillotina.interfacesimportIResourcefromguillotina.responseimportHTTPForbiddenfromguillotina.utilsimportget_current_request@configure.subscriber(for_=(IResource, IBeforeObjectModifiedEvent), priority=1)asyncdefcheck_modifing_latest_version(obj, event):
request=get_current_request()
iflast_mod_date:=request.headers.get("last-mod-date"):
last_mod_date=isoparse(last_mod_date)
iflast_mod_date!=obj.modification_date:
raiseHTTPForbidden(
content={
"error": f"Provided version {last_mod_date} is behind {obj.modification_date}"
}
)
@bloodbare@vangheem do we want to add this to guillotina in a contrib like the linked issue #1025? I'm asking because @aralroca would like to move our implementation to Guillotina React.
The text was updated successfully, but these errors were encountered:
Ohh, I didn't know ETag could be used to avoid collisions! We need to add ETag support to Guillotina first but I like the idea of using the ETag header instead of a custom one
The following code is something we use in conjunction with #1025 to prevent patching an object with outdated info:
@bloodbare @vangheem do we want to add this to guillotina in a contrib like the linked issue #1025? I'm asking because @aralroca would like to move our implementation to Guillotina React.
The text was updated successfully, but these errors were encountered: