Is there a "right" way to add and remove directories to TEMPLATE_DIRS
on the fly? Is it right to do at all?

I tried to just add a directory, but realized that the settings are
not per request, but per server thread, so that a directory added by
one request is also there for the next request, which causes some
trouble for me.

My case:

I am making a generic system for generating some playlists. Playlists
for most channels look exactly the same, but some has small
differences in how it should appear (e.g. they should not include a
thumbnail for the video, or maybe the order of the data presented
should be slightly different).

I'm using a set of templates, each one for each part of the playlist,
making it easy - in theory - to alter small parts of the playlist for
each channel, simply by adding another template directory for the
specific channel.

But when the added directory is stored across requests, a playlist for
Channel A might be generated with templates from Channel B if the
template directory for the latter has been added to TEMPLATE_DIRS.

My solution for now is adding the custom directory (if necessary), and
then removing it at the end of the request, after the HTML has been
generated.

BUT! What happens then if 2 request hit the same server thread at the
same time? Is there a risk of the second request getting the wrong
templates (from the first request) if the first request has not yet
removed it's directory from TEMPLATE_DIRS? Or are requests to the same
thread queued and won't interfere with each other?

--

Best regards, Mikkel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to