On 06/07/11 21:41, Daniel Swarbrick wrote: > Or can we perhaps even add an option to FilePathField that would > refresh the choices each time? I'm not entirely sure how that would > work... proxy function maybe?
That sounds like a reasonable idea to me, since doing it by default could impose a serious performance hit. In it's most naive form (i.e. making the 'choices' attribute a lazy list using django.utils.functional.lazy) this wouldn't be too hard to implement. However, that would mean that *every* time it was accessed it would have to walk the file system to get the choices, which could easily get crazy. A better solution would add some level of caching. This sounds like we need an option that specifies the number of seconds to cache for. It would be OK to require that there is a cache backend active for this to work. We could have a single setting that controls the two e.g. cache_paths_for - if it was None (the default) then it would cache forever. Feel free to open a ticket for this. Luke -- A mosquito cried out in pain: "A chemist has poisoned my brain!" The cause of his sorrow was para-dichloro- diphenyltrichloroethane Luke Plant || http://lukeplant.me.uk/ -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. 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.
