-
-
Notifications
You must be signed in to change notification settings - Fork 867
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
Missing implementations of the Django interface for time metadata due to missing timezone information #1233
Comments
The second methods were originally in Django but were deprecated and removed in favor of the first a few versions ago. The correct thing to do is option 1 and remove the others since they are dead but clearly the demand doesn’t exist because no one has opened a PR. Would very happily review and accept a PR that implemented 1 and removed the dead methods. |
That explains the discrepancy.
As you say, we should definitely implement the new Also, how about keeping the old |
Working with legacy versions isn't a concern of mine; we should remove the removed methods. Libraries that depend on them are broken. |
Okay. Still, what to do about storage backends that do not have access to timezone information? How could the new (necessarily timezone-aware) |
I opened #1240 to fix this issue. I chose to keep the old interface around because some storage backends, i.e., FTP and SFTP, cannot be timezone-aware without outside help. |
The various backends feature two sets of methods for accessing time metadata:
get_(accessed|created|modified)_time
: Official Django interface. The returneddatetime
must be timezone aware if Django settingUSE_TZ
isTrue
, else naive in the local timezone. This means the remote timezone must be known in order to be able to either (ifUSE_TZ=True
) attach timezone information to thedatetime
or else (ifUSE_TZ=False
) first shift thedatetime
from remote timezone to local timezone (and then remove the timezone information). Since not all backends know the remote timezone, this is not always implemented. Instead, there is also the following.(accessed|created|modified)_time
:django-storages
methods. The returneddatetime
is always naive. However, it is unclear in which timezone thatdatetime
is. Those backends that know the remote timezone first shift thisdatetime
to the local timezone (and then remove the timezone information), whereas the others leave it without timezone information in the unknown remote timezone.Availability (✅ = implemented, ❌ = not implemented):
accessed_time
created_time
modified_time
get_accessed_time
get_created_time
get_modified_time
Options:
NotImplementedError
ifUSE_TZ
isTrue
but timezone information is missing. However, I doubt that conforms to the interface considering the Django documentation explicitly states that the naivedatetime
must be in the local timezone, which means the remote timezone must be known to be able to shift the naivedatetime
to the local timezone.NotImplementedError
if timezone information is missing.The text was updated successfully, but these errors were encountered: