def process_request(self, request): """ Set the thread's pinning flag according to the presence of the session variable. """ pinned_until = request.session.get(PINNING_KEY, False) if pinned_until and pinned_until > datetime.now(): pinning.pin_thread()
def process_request(self, request): """ Set the thread's pinning flag according to the presence of the cookie. """ if PINNING_KEY in request.COOKIES: pinning.pin_thread()
def db_for_write(self, model, **hints): pinning.set_db_write() pinning.pin_thread() return super(PinningMixin, self).db_for_write(model, **hints)