def test_dropbox_connection(): """Checks whether current dropbox account is authenticated.""" logger.info("<< Testing dropbox connection") dropbox_facade = DropboxAPIFacade(True) was_connected = dropbox_facade.is_authorized() logger.info(" + Dropbox authorized: " + repr(was_connected)) system_status.set_dropbox_connection(was_connected) logger.info(">> Testing dropbox connection complete") return time.time()
def disconnect(): """Creates a stop users get sent to when they disconnects their dropbox account.""" service_daemon = ServiceDaemon() service_daemon.pause() dropbox_access.delete_access_token() gsystem_status.set_dropbox_connection(False) service_daemon = ServiceDaemon() service_daemon.resume() flash(__("Your account was disconnected from Dropbox")) return redirect(url_for("dropbox_page"))
def authorize(): """Creates a stop users get sent to after dropbox authentication.""" service_daemon = ServiceDaemon() service_daemon.pause() static_facade.obtain_access_token() was_connected = static_facade.is_authorized() gsystem_status.set_dropbox_connection(was_connected) if was_connected == False: logger.error("Something went wrong after the user was redirected") flash(__("Something went wrong when connecting your account"), "error") else: flash(__("Your account was successfully connected to Dropbox"), "success") service_daemon = ServiceDaemon() service_daemon.resume() return redirect(url_for("dropbox_page"))