Okay, just a quick update. I don't have a new patch ready yet, because I wanted to outline a couple things and ask another question. I've implemented the callable method for determining filenames, including the ability to include a subdirectory in the filename. Also, ignore my comment about reusing "default" for the callable argument. Doing so causes more problems than it solves, and it's not really better anyway. So, "filename" is what I'm going with for now.
In doing so, I ran once again into a concern I had a while back, regarding the strftime stuff currently supported by FileField. I've gotten them to play nicely with the new filename callable, but it makes for a bit of overlap, and i was wondering if it'd be possible to merge them somehow. Consider the following example: def get_filename(obj, filename): return '%s/%s' % (obj.id, filename) file = models.FileField(upload_to='songs/%Y/%m/%d', filename=get_filename) Currently, this would store the path as something like 'songs/2007/10/26/13/song.mp3', by having to combine the two methods. It's not difficult to do this, but it seems to me that it might make more sense to try to move the strftime stuff out from built-in functionality to just another callable-driven path modification. def get_filename(obj, filename): return '%s/%s/%s' % (strftime('%Y/%m/%d'), obj.id, filename) file = models.FileField(upload_to='songs', filename=get_filename) But then there's some confusion as to what would happen if someone tried the first example mentioned above. Should it still also respect the strftime formatting in upload_to? One way feels less "clean", but the other has potential real-world problems. Any advice? Am I missing a third option that solves it all? Also, speaking of strftime formatting, the current filestorage patch moves that feature into the FileSystemBackend, rather than in the backend-neutral sections. That means that any additional backends would have to duplicate it if they want to use it. This seems appropriate to me, though, because many other backends wouldn't benefit as much from it. Thoughts? -Gul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---