def setup_drive(self): try: if not drive_settings.automatic_sharing_is_available( self.app_context): raise errors.NotConfigured # pylint: disable=protected-access self.drive_manager = ( drive_api_manager._DriveManager.from_app_context( self.app_context)) # pylint: enable=protected-access except errors.NotConfigured: self.redirect('/' + DriveNotConfiguredHandler.URL, abort=True)
def setup_drive(self): try: if not drive_settings.automatic_sharing_is_available( self.app_context): raise errors.NotConfigured # pylint: disable=protected-access self.drive_manager = ( drive_api_manager._DriveManager.from_app_context( self.app_context)) # pylint: enable=protected-access except errors.NotConfigured: self.redirect('/' + DriveNotConfiguredHandler.URL, abort=True)
def get(self): super(DriveListHandler, self).get() items = _sorted_drive_items(drive_models.DriveSyncDAO.get_all()) self.render_this( items=items, automatic_sharing_is_available= drive_settings.automatic_sharing_is_available(self.app_context), google_api_key=drive_settings.get_google_api_key(self.app_context), google_client_id= drive_settings.get_google_client_id(self.app_context), add_rest_xsrf_token= self.create_xsrf_token(DriveAddRESTHandler.ACTION), add_rest_url=DriveAddRESTHandler.URL, # pylint: disable=protected-access job_status_url=self.app_context.canonicalize_url( '/rest/core/jobs/status?name={}'.format( jobs.DriveSyncJob(self.app_context)._job_name)), # pylint: enable=protected-access sync_url=DriveSyncHandler.URL, sync_xsrf_token=self.create_xsrf_token(DriveSyncHandler.ACTION), sync_xsrf_action=DriveSyncHandler.ACTION, job_url=DriveSyncJobHandler.URL, job_xsrf_token=self.create_xsrf_token( DriveSyncJobHandler.ACTION), job_xsrf_action=DriveSyncJobHandler.ACTION, header_hooks=self.EXTRA_HEADER_CONTENT, row_hooks=self.EXTRA_ROW_CONTENT, app_context=self.app_context, # urls this_url=self.URL, item_url=DriveItemHandler.URL, content_url=DriveContentHandler.URL, sheets_to_site_url=( '/modules/sheets_to_site/_static/index.html?course={}'.format( self.app_context.get_slug())), )