()
Check session and initialize if necessary

    Before every request, check the user session.  If no session exists, add
    one and provide temporary locations for images
Check session and initialize if necessary
Check session and initialize if necessary
def initialize_new_session():
    """Check session and initialize if necessary

    Before every request, check the user session.  If no session exists, add
    one and provide temporary locations for images

    """
    if 'image_uid_counter' in session and 'image_list' in session:
        logger.debug('images are already being tracked')
    else:
        # reset image list counter for the session
        session['image_uid_counter'] = 0
        session['image_list'] = []
    if 'img_input_dir' in session and 'img_output_dir' in session:
        logger.debug('temporary image directories already exist')
    else:
        # make image upload directory
        session['img_input_dir'] = mkdtemp()
        session['img_output_dir'] = mkdtemp()
def initialize_new_session ( ) : if 'image_uid_counter' in session and 'image_list' in session : logger . debug ( 'images are already being tracked' ) else : # reset image list counter for the session session [ 'image_uid_counter' ] = 0 session [ 'image_list' ] = [ ] if 'img_input_dir' in session and 'img_output_dir' in session : logger . debug ( 'temporary image directories already exist' ) else : # make image upload directory session [ 'img_input_dir' ] = mkdtemp ( ) session [ 'img_output_dir' ] = mkdtemp ( )