-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Allow gzip mtime to be a datetime object #128584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This would create a dependency between It is not hard to call the |
Hi @serhiy-storchaka, thank you for your comments.
This is a fair point, although I would point out that
This is true, although I would use the same argument as with supporting |
The difference is that we can cast it to
Could you give us more details here please? From a purely personal opinion, I think |
Hi @picnixz, thank you for your comments.
I would like to expand the current
This is fair, but that timestamp does represent a specific date and time, which for the purposes of investigating the metadata seems like a good idea? It also gives us a chance to raise an error if a user is in danger of leaking location information unknowingly, as mentioned in this comment on the PR:
|
I would suggest not changing the current API for the sake of a future API. In particular, I think it's better to still use pure timestamp for the creation date and not datetime objects. In addition, I think this kind of feature request should probably have a prior discussion before.
Yes but I see integral timestamps as being more generic than datetime objects. Datetime objects come with an interface and more responsibilities than just an integer-like value. We can also pass fractional timestamps as mtime as they are truncated by Now, for a third-party package, I think it would be fine to have that feature, but for the standard library, this requires to maintain those new objects. I suggest rewriting the initial prototype using pure integers and present a PoC on Discourse to gain traction. I also think that if we change
Well, it's the responsibility of the server to use UTC datetime objects, namely they should instead use
I fail to understand how this enforces the RFC as I could only find:
We can however mention in the docs how to use a datetime object with the compression function, as well as what it entails from a privacy PoV. Note that while it can leak the location, it's only if the querier knows when the compression has been done and they can compare with whether the embedded timestamp is correct or not (assuming again that the server used a non-UTC datetime object to create the timestamp). They can easily create a timezone-agnostic timestamp by doing |
This makes sense – the intention was to avoid making multiple changes in a single feature, but I appreciate this perspective.
Fair enough.
I can certainly do this. By "present a PoC on Discourse", presumably you mean starting a new thread here?
I'm referring to the "GMT" part I suppose – preventing scenarios where a user creates a naive
The classic example is web requests, which admittedly isn't the most common use case of the |
yes
In the case of this specific feature request, that's what I think. The maintenance cost outweights the benefits IMO. We can however improve the docs and/or indicate the use of
that's what I meant by querier knowing when it has been done. Btw, wouldn't it be a use-case if the server serves |
Feature or enhancement
Proposal:
Currently, the
mtime
optional parameter of thegzip.GzipFile
class andgzip.compress
function can be an float representing a Unix timestamp, orNone
to use the current time. I propose allowing this to also be adatetime.datetime
object. All of these would then be possible:This avoids users needing to cast their
datetime
objects into timestamps before callingcompress
or creating aGzipFile
instance, which can lead to mistakes.I have an initial PR for this ready to go.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: