Hello, I've some code which is duplicated between all my views and it violate the DRY principle. So, I would like to use the decorators to eliminate the duplicated code. Does someone has a simple example on how to do that.
The code I would like to factorise is the following one : if 'is_logged' not in request.session: request.session['is_logged'] = False if 'user_id' in request.session: unread_messages_count = InternalMessage.objects.filter(to_clubber__id=request.session['user_id'],read=False).count() total_messages_count = InternalMessage.objects.filter(to_clubber__id=request.session['user_id']).count() else: unread_messages_count = total_messages_count = None To summarize, I would like to : - populate the function namespace with some vars - manipulate the sessions Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---