Форум сайта python.su
Во вью добавляю код:
print Session.objects.all()[0].get_decoded()
Офлайн
def get_decoded(self): encoded_data = base64.decodestring(self.session_data) pickled, tamper_check = encoded_data[:-32], encoded_data[-32:] if md5_constructor(pickled + settings.SECRET_KEY).hexdigest() != tamper_check: from django.core.exceptions import SuspiciousOperation raise SuspiciousOperation("User tampered with session cookie.") try: return pickle.loads(pickled) # Unpickling can cause a variety of exceptions. If something happens, # just return an empty dictionary (an empty session). except: return {}
Отредактировано Chern (Сен. 12, 2012 12:36:17)
Офлайн
Да, пустая была, я просто не знал, что такое возможно.
Офлайн