def set_cookie(self, name, value, domain=None, expires=None, path='/', expires_days=None): if expires_days is not None and not expires: expires = datetime.datetime.utcnow() + datetime.timedelta( days=expires_days) value = str(base64.b64encode(value)) set_cookie(name, value, path=path, domain=domain, expires=expires)
def set_gaema_user(service, user): gaema_user_key = GAEMA_USER_KEY_FORMAT % service if hasattr(settings, "GAEMA_STORAGE") and settings.GAEMA_STORAGE == "cookie": secure_cookie = SecureCookie(user, secret_key=settings.SECRET_KEY) user_data = secure_cookie.serialize() set_cookie(gaema_user_key, user_data) else: from kay.sessions import renew_session renew_session(local.request) local.request.session[gaema_user_key] = user local.request.session.modified = True
def set_cookie(self, name, value, domain=None, expires=None, path="/", expires_days=None): if expires_days is not None and not expires: expires = datetime.datetime.utcnow() + datetime.timedelta(days=expires_days) value = str(base64.b64encode(value)) set_cookie(name, value, path=path, domain=domain, expires=expires)
def _set_flash_msg(request, message): set_cookie('ls_message', SecureCookie({'m':message}, settings.SECRET_KEY).serialize())
def create_marketplace_logout_url(domain, nexturl="/"): next_url_key = NEXT_URL_KEY_FORMAT % domain set_cookie(next_url_key, nexturl) return url_for("gaema/marketplace_logout", domain=domain)
def create_gaema_logout_url(service, nexturl="/"): next_url_key = NEXT_URL_KEY_FORMAT % service set_cookie(next_url_key, nexturl) return url_for("gaema/logout", service=service)
def _set_flash_msg(request, message): set_cookie('ls_message', SecureCookie({ 'm': message }, settings.SECRET_KEY).serialize())