Esempio n. 1
0
  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)
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 4
0
    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)
Esempio n. 5
0
def _set_flash_msg(request, message):
  set_cookie('ls_message', 
      SecureCookie({'m':message}, settings.SECRET_KEY).serialize())
Esempio n. 6
0
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)
Esempio n. 7
0
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)
Esempio n. 8
0
def _set_flash_msg(request, message):
    set_cookie('ls_message',
               SecureCookie({
                   'm': message
               }, settings.SECRET_KEY).serialize())
Esempio n. 9
0
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)
Esempio n. 10
0
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)