Another update on this proposal:

I just wrote a patch to make the described idea possible and recycled the already existing ticket http://code.djangoproject.com/ticket/10497 for that.

You'll find a patch attached to the ticket.

Stephan Jäkel wrote:
Hi,

this proposal is about extending the storage backend api of Django.

The storage backend has already many helpful methods to get information
about stored files like:
- name
- size
- full path (for some backends).

I think it could be useful to have some more methods to get information
about times:
- accessed time
- created time
- modified time

By adding this methods, Django's storage backend would provide a
standardized way to get the times.

The default implementation could go the same way as "path",
class Storage:
def path(self, name):
raise NotImplementedError("This backend doesn't support absolute paths.")

If a storage backend implement one of the new methods "accessed_time",
"modified_time" or "created_time", the backend has to return a Datetime
object.

I would implement this for the included storage backends, write tests
and docs at the sprints in Portland.

FYI, there is a ticket in trac which recommends to add a "stat" method
but I think this maybe would be hard to implement on backends like S3.

By splitting the times up in three methods, backend providers can decide
which data they provide.

This is a fairly short proposal but I think its not a big change and
just adds some conventions to the storage backend api.

Looking forward to your feedback!

Cheers,

Steph


--
You received this message because you are subscribed to the Google Groups "Django 
developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to