Django Thread-Safety for templatetags
        Posted  
        
            by Acti67
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Acti67
        
        
        
        Published on 2010-06-01T07:21:30Z
        Indexed on 
            2010/06/01
            7:23 UTC
        
        
        Read the original article
        Hit count: 298
        
Hi,
I am coming here, because I have a question about Django and Thread. I read the documentation http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#template-tag-thread-safety and I would like to now if the next code could be impacted also, at the rendering context.
class ChatterCountNode(NodeBase):
    def __init__(self, channelname, varname):
        self.channelname = channelname
        self.varname = varname
    def render(self, context):
        channelname = self.getvalue(context, self.channelname)
        varname = self.getvalue(context, self.varname)
        count = get_channel_count(channelname)
        context[varname] = count
        return ''
Thank you for your time.
Stéphane
© Stack Overflow or respective owner