Mercurial > p > roundup > code
view detectors/immutable_file_contents.py @ 8566:e4191aa7b402 default tip
doc: issue2551415 correct doc for change input->input_payload
in 2.5 the rest interface changed a variable name from input to
input_payload. An earlier commit changed the rest docs. This commit
adds an item for it to the upgrading 2.4.0->2.5.0 section. Also cross
reference added to the rest docs with the updated examples.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 09 Apr 2026 00:19:06 -0400 |
| parents | e738377b4ffe |
| children |
line wrap: on
line source
# HTML pages don't provide a way to change the contents of a file. # However REST does allow setting content and the HTML interface can # be directed to update the content as well. This detector # prevents changes to file content. from roundup.exceptions import UsageError def immutable_file_contents(db, cl, nodeid, newvalues): ''' Prevent content changes to a file ''' if 'content' in newvalues: raise UsageError("File contents are immutable. " "Rejecting change to contents.") def init(db): """If you have other FileClass based classes add them here.""" # fire before changes are made db.file.audit('set', immutable_file_contents) db.msg.audit('set', immutable_file_contents)
