Web UI: Upload to tmp file name then rename if successful#1272
Web UI: Upload to tmp file name then rename if successful#1272
Conversation
b354733 to
70c7184
Compare
70c7184 to
c9468a1
Compare
| try: | ||
| archive_info = self._get_archive_info( | ||
| f"{server_info['image_dir']}/{file.name}", | ||
| _cache_extra_key=file.size, |
There was a problem hiding this comment.
I think I remember what this is for now, which was a somewhat brittle cache invalidator for when a file is replaced with another of the same name. Otherwise, we'll return the previous file.
There was a problem hiding this comment.
Aha! I was confused because _cache_extra_key wasn't actually called in our code. So I assume it's used by the cache library behind the scenes then?
c9468a1 to
bed15f6
Compare
|
|
||
| def __init__(self, sock_cmd: SocketCmds, piscsi: PiscsiCmds, token=None, locale=None): | ||
| self.sock_cmd = sock_cmd | ||
| def __init__(self, piscsi: PiscsiCmds): |
There was a problem hiding this comment.
@nucleogenic Question! What do you think about not initializing the class with the PiscsiCmds object? The original motivation was for sharing the token and locale, I believe. But now when FileCmds doesn't access the protobuf interface anymore it's not really needed, is it?
There was a problem hiding this comment.
Never mind; I gave it a go and quickly realized that instantiating a new PiscsiCmds object is a pain.
Additionally, in order to simplify access to the file commands class in the file upload function, refactoring associated code to: