<s> """<STR_LIT>""" <EOL> try : <EOL> import sqlalchemy <EOL> SQLALCHEMY_INSTALLED = True <EOL> except ImportError : <EOL> SQLALCHEMY_INSTALLED = False <EOL> from flask_store import Provider <EOL> from flask_store . exceptions import NotConfiguredError <EOL> from werkzeug . datastructures import FileStorage <EOL> class FlaskStoreType ( sqlalchemy . types . TypeDecorator ) : <EOL> """<STR_LIT>""" <EOL> impl = sqlalchemy . Unicode ( <NUM_LIT> ) <EOL> def __init__ ( self , max_length = <NUM_LIT> , location = None , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> if not SQLALCHEMY_INSTALLED : <EOL> raise NotConfiguredError ( <EOL> '<STR_LIT>' ) <EOL> self . location = location <EOL> super ( FlaskStoreType , self ) . __init__ ( * args , ** kwargs ) <EOL> self . impl = sqlalchemy . types . Unicode ( max_length ) <EOL> def process_bind_param ( self , value , dialect ) : <EOL> """<STR_LIT>""" <EOL> if not isinstance ( value , FileStorage ) : <EOL> return None <EOL> provider = Provider ( value , location = self . location ) <EOL> provider . save ( ) <EOL> return provider . relative_path <EOL> def process_result_value ( self , value , dialect ) : <EOL> """<STR_LIT>""" <EOL> provider = Provider ( value , location = self . location ) <EOL> return provider </s>
