def set_cookie_data(storage, messages, invalid=False, encode_empty=False):
 encoded_data = storage._encode(messages, encode_empty=encode_empty)
 if invalid:
  encoded_data = encoded_data[1:]
 storage.request.COOKIES = {CookieStorage.cookie_name: encoded_data}
 if hasattr(storage, '_loaded_data'):
  del storage._loaded_data

def set_cookie_data ( storage , messages , invalid = False , encode_empty = False ) : encoded_data = storage . _encode ( messages , encode_empty = encode_empty ) if invalid : encoded_data = encoded_data [ 1 : ] storage . request . COOKIES = { CookieStorage . cookie_name : encoded_data } if hasattr ( storage , '_loaded_data' ) : del storage . _loaded_data
set request .