Projet

Général

Profil

0001-misc-display-completion-status-for-multi-actions-414.patch

Lauréline Guérin, 25 septembre 2020 15:59

Télécharger (2,48 ko)

Voir les différences:

Subject: [PATCH] misc: display completion status for multi actions (#41404)

 wcs/backoffice/management.py | 6 +++++-
 wcs/qommon/afterjobs.py      | 5 +++--
 wcs/qommon/http_response.py  | 1 +
 3 files changed, 9 insertions(+), 3 deletions(-)
wcs/backoffice/management.py
1881 1881

  
1882 1882
            def execute(self, job=None):
1883 1883
                formdatas = self.formdef.data_class().get_ids(self.item_ids)
1884
                job.completion_status = '{}/{}'.format(0, len(formdatas))
1885
                job.store()
1884 1886
                publisher = get_publisher()
1885
                for formdata in formdatas:
1887
                for i, formdata in enumerate(formdatas):
1886 1888
                    publisher.substitutions.reset()
1887 1889
                    publisher.substitutions.feed(publisher)
1888 1890
                    publisher.substitutions.feed(self.formdef)
......
1894 1896
                    else:
1895 1897
                        # global action
1896 1898
                        formdata.perform_global_action(self.action['action'].id, self.user)
1899
                    job.completion_status = '{}/{}'.format(i+1, len(formdatas))
1900
                    job.store()
1897 1901

  
1898 1902
        item_ids = get_request().form['select[]']
1899 1903
        if '_all' in item_ids:
wcs/qommon/afterjobs.py
31 31

  
32 32
        response = get_response()
33 33
        response.set_content_type('text/plain')
34
        return job.status + '|' + _(job.status)
35

  
34
        if not job.completion_status:
35
            return job.status + '|' + _(job.status)
36
        return job.status + '|' + _(job.status) + ' ' + job.completion_status
wcs/qommon/http_response.py
36 36
    status = None
37 37
    creation_time = None
38 38
    completion_time = None
39
    completion_status = None
39 40

  
40 41

  
41 42
class HTTPResponse(quixote.http_response.HTTPResponse):
42
-