Skip to content
module.py 138 KiB
Newer Older
            app.logger.debug( "{}: {}".format( segment[ "uuid" ], img ) )
            
            try:
                config.pianosdb.create_exercise( 
                    folder_id,
                    segment[ "uuid" ], "",
                    img, segment[ "resolution" ],
                    empty_img_id, empty_img_res
                )
            except caseExistsInDB:
                continue
            except:
                raise
        
        config.pianosdb.commit()
################################################################################
#    Home page

@app.route( baseurl + "/" )
def home():
    """
        Serve the homepage to all users.
    """
    if session[ "account_type_name" ] == "Donor":
        return redirect( url_for( "user_myprofile_dek" ) )
    
    elif session[ "account_type_name" ] == "Submitter":
        return redirect( url_for( "submission_list" ) )
    
    else:
        return my_render_template( "index.html" )
################################################################################
#    Main application configuration
gpg = gnupg.GPG( **config.gpg_options )

for key_file in os.listdir( config.keys_folder ):
    with open( config.keys_folder + "/" + key_file, "r" ) as fp:
        gpg.import_keys( fp.read() )

account_type_id_name = {}
sql = "SELECT id, name FROM account_type"
for at in config.db.query_fetchall( sql ):
    account_type_id_name[ at[ "id" ] ] = at[ "name" ]