<s> from flask import current_app , session <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> class OAuthProperty ( object ) : <EOL> """<STR_LIT>""" <EOL> _missing = object ( ) <EOL> def __init__ ( self , name , default = _missing ) : <EOL> self . name = name <EOL> self . default = default <EOL> def __get__ ( self , instance , owner ) : <EOL> if instance is None : <EOL> return self <EOL> instance_namespace = vars ( instance ) <EOL> instance_ident = instance . name <EOL> if self . name in instance_namespace : <EOL> return instance_namespace [ self . name ] <EOL> config_name = '<STR_LIT>' . format ( instance_ident , self . name ) . upper ( ) <EOL> if config_name not in current_app . config : <EOL> if self . default is not self . _missing : <EOL> return self . default <EOL> exception_message = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( instance , self . name , config_name ) <EOL> raise RuntimeError ( exception_message ) <EOL> return current_app . config [ config_name ] <EOL> def __set__ ( self , instance , value ) : <EOL> instance_namespace = vars ( instance ) <EOL> instance_namespace [ self . name ] = value <EOL> class WebSessionData ( object ) : <EOL> """<STR_LIT>""" <EOL> key_format = '<STR_LIT>' <EOL> def __init__ ( self , ident ) : <EOL> self . ident = ident <EOL> def make_key ( self , instance ) : <EOL> return self . key_format . format ( instance . name , self . ident ) <EOL> def __get__ ( self , instance , owner ) : <EOL> if instance is None : <EOL> return self <EOL> return session . get ( self . make_key ( instance ) ) <EOL> def __set__ ( self , instance , value ) : <EOL> session [ self . make_key ( instance ) ] = value <EOL> def __delete__ ( self , instance ) : <EOL> session . pop ( self . make_key ( instance ) , None ) </s>
