def remove(self): if self.request.get('REQUEST_METHOD', 'POST') and \ self.request.form.get('form.action.remove', '') == 'Remove': authenticator = getMultiAdapter((self.context, self.request), name=u"authenticator") if not authenticator.verify(): raise Unauthorized # find the job sitepath = self.context.getPhysicalPath() async = getUtility(IAsyncService) queue = async .getQueues()[''] objpath = self.request.form.get('path') obj = self.context.restrictedTraverse(str(objpath), None) if obj is None: return self.redirect() objpath = obj.getPhysicalPath() jobs = [job for job in queue] for job in jobs: if isConversion(job, sitepath) and \ job.args[0] == objpath: try: queue.remove(job) settings = Settings(obj) settings.converting = False except LookupError: pass return self.redirect() return self.redirect()
def remove(self): if self.request.get('REQUEST_METHOD', 'POST') and \ self.request.form.get('form.action.remove', '') == 'Remove': authenticator = getMultiAdapter((self.context, self.request), name=u"authenticator") if not authenticator.verify(): raise Unauthorized # find the job sitepath = self.context.getPhysicalPath() async = getUtility(IAsyncService) queue = async.getQueues()[''] objpath = self.request.form.get('path') object = self.context.restrictedTraverse(str(objpath), None) if object is None: return self.redirect() objpath = object.getPhysicalPath() jobs = [job for job in queue] for job in jobs: if isConversion(job, sitepath) and \ job.args[0] == objpath: try: queue.remove(job) settings = Settings(object) settings.converting = False except LookupError: pass return self.redirect() return self.redirect()
def jobs(self): results = [] if asyncInstalled(): sitepath = self.context.getPhysicalPath() async = getUtility(IAsyncService) queue = async.getQueues()[''] quota = queue.quotas[QUOTA_NAME] for job in quota._data: if isConversion(job, sitepath): results.append(self.get_job_data(job, sitepath, False)) jobs = [job for job in queue] for job in jobs: if isConversion(job, sitepath): results.append(self.get_job_data(job, sitepath)) return results
def jobs(self): results = [] if asyncInstalled(): sitepath = self.context.getPhysicalPath() async = getUtility(IAsyncService) queue = async .getQueues()[''] quota = queue.quotas[QUOTA_NAME] for job in quota._data: if isConversion(job, sitepath): results.append(self.get_job_data(job, sitepath, False)) jobs = [job for job in queue] for job in jobs: if isConversion(job, sitepath): results.append(self.get_job_data(job, sitepath)) return results