Esempio n. 1
0
    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
Esempio n. 2
0
    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
Esempio n. 3
0
    def __call__(self):
        """
        - handle queuing
        - csrf protection
        - async
            - queue position
        """
        mtool = getToolByName(self.context, 'portal_membership')
        self.manager = mtool.checkPermission('cmf.ManagePortal',
                                             self.context)
        self.async_installed = asyncInstalled()
        self.converting = False
        if self.enabled():
            req = self.request
            if req.get('REQUEST_METHOD', 'POST') and \
               'form.action.queue' in req.form.keys():
                authenticator = getMultiAdapter((self.context, self.request),
                                                name=u"authenticator")
                if not authenticator.verify():
                    raise Unauthorized

                settings = Settings(self.context)
                settings.last_updated = DateTime('1999/01/01').ISO8601()
                settings.filehash = '--foobar--'
                queueJob(self.context)
                self.converting = True
                if self.async_installed:
                    self.position = JobRunner(self.context).find_position()
                    queueJob(self.context)
                else:
                    return self.request.response.redirect(
                        self.context.absolute_url() + '/view')
            else:
                if self.async_installed:
                    self.position = JobRunner(self.context).find_position()
                    if self.position > -1:
                        self.converting = True

            return super(Convert, self).__call__()

        self.request.response.redirect(self.context.absolute_url() + '/view')
Esempio n. 4
0
    def __call__(self):
        """
        - handle queuing
        - csrf protection
        - async
            - queue position
        """
        mtool = getToolByName(self.context, 'portal_membership')
        self.manager = mtool.checkPermission('cmf.ManagePortal',
                                             self.context)
        self.async_installed = asyncInstalled()
        self.converting = False
        if self.enabled():
            req = self.request
            if req.get('REQUEST_METHOD', 'POST') and \
               'form.action.queue' in req.form.keys():
                authenticator = getMultiAdapter((self.context, self.request),
                                                name=u"authenticator")
                if not authenticator.verify():
                    raise Unauthorized

                settings = Settings(self.context)
                settings.last_updated = DateTime('1999/01/01').ISO8601()
                settings.filehash = '--foobar--'
                queueJob(self.context)
                self.converting = True
                if self.async_installed:
                    self.position = JobRunner(self.context).find_position()
                    queueJob(self.context)
                else:
                    return self.request.response.redirect(
                        self.context.absolute_url() + '/view')
            else:
                if self.async_installed:
                    self.position = JobRunner(self.context).find_position()
                    if self.position > -1:
                        self.converting = True

            return super(Convert, self).__call__()

        self.request.response.redirect(self.context.absolute_url() + '/view')
Esempio n. 5
0
 def async_enabled(self):
     return asyncInstalled()
 def async_enabled(self):
     return asyncInstalled() or celeryInstalled()
 def async_enabled(self):
     return asyncInstalled() or celeryInstalled()
Esempio n. 8
0
 def async_enabled(self):
     return asyncInstalled()