#27644: FileSystemStorage --- get_created_time method does not work on Unix
------------------------------------------------+------------------------
Reporter: Jonathan Verner | Owner: nobody
Type: Bug | Status: new
Component: File uploads/storage | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
The method {{{get_created_time}}} uses {{{os.path.getctime}}} which only
returns the creation time on Windows. On Unix it returns the **change
time** , i.e. the last time the inode attributes were modified (see
[http://stackoverflow.com/questions/237079/how-to-get-file-creation-
modification-date-times-in-python]). The documentation says that
For storage systems unable to return the creation time this will raise
NotImplementedError
so the correct behaviour would be, IHMO, to raise a
{{{NotImplementedError}}} on Unix platforms. I am not sure whether the
method is used anywhere---searching on github only came up with uses in
tests, docs and the place where it is defined. Also, as noted by a
commenter on the above stackoverflow question, it doesn't seem to be a
useful value anyway:
Frankly, file creation time is usually fairly useless. When you open
an existing file for write with mode "w", it's not replacing it, it just
opens the existing file and truncates it. Even though the file contents
are completely unrelated to whatever it had on creation, you'd still be
told the file was "created" well before the current version. Conversely,
editors that use atomic replace on save (original file is replaced by new
work-in-progress temp file) would show a more recent creation date, even
if you just deleted one character. Use the modification time, don't grub
for creation time.
So it might make sense to remove the method altogether.
--
Ticket URL: <https://code.djangoproject.com/ticket/27644>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/057.c17e658549d9951038f286109f8cbd83%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.