On Jun 19, 5:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> It seems to me you can just do: > if self.field.cache_choices: > qs = self.queryset > else: > qs = self.queryset.all() > for obj in qs: > .... I thought about doing that, but then that would lead to the race condition again if cache_choices is True. The other options I can see are: 1. Utilise Django's cache framework to implement caching of choices (would need to decide on which cache key to use, and thread-safety would depend on the cache backend). 2. Utilise simple thread synchronisation mechanisms to control access to the queryset in question. This would only need to be done when cache_choices is True, so in the usual case when it is False there would be no performance impact. 3. Drop support for cache_choices altogether, as it can be easily implemented (e.g. using the cache framework) if really necessary. I feel that #2 is the best choice, what do other people think? Cheers, Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---