Projet

Général

Profil

0001-workflows-generalize-get_target_status-into-base-cla.patch

Frédéric Péters, 13 décembre 2015 17:03

Télécharger (2,18 ko)

Voir les différences:

Subject: [PATCH] workflows: generalize get_target_status into base class
 (#9303)

This gives a working get_target_status to the Editable action item.
 wcs/workflows.py | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
wcs/workflows.py
1257 1257

  
1258 1258
    def get_target_status(self):
1259 1259
        """Returns a list of status this item can lead to."""
1260
        if not getattr(self, 'status', None):
1261
            return []
1262

  
1263
        try:
1264
            return [x for x in self.parent.parent.possible_status if x.id == self.status]
1265
        except IndexError:
1266
            get_publisher().get_app_logger().error(
1267
                            'reference to invalid status in workflow %s, status %s, item %s' % (
1268
                                    self.parent.parent.name,
1269
                                    self.parent.name,
1270
                                    self.description))
1260 1271
        return []
1261 1272

  
1262 1273
    def get_jump_label(self):
......
1296 1307
    status = None
1297 1308
    endpoint = False
1298 1309

  
1299
    def get_target_status(self):
1300
        if not self.status:
1301
            return []
1302
        try:
1303
            return [x for x in self.parent.parent.possible_status if x.id == self.status]
1304
        except IndexError:
1305
            get_publisher().get_app_logger().error(
1306
                            'reference to invalid status in workflow %s, status %s, item %s' % (
1307
                                    self.parent.parent.name,
1308
                                    self.parent.name,
1309
                                    self.description))
1310
            return []
1311

  
1312 1310
    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
1313 1311
        if 'status' in parameters:
1314 1312
            form.add(SingleSelectWidget, '%sstatus' % prefix, title = _('Status'), value = self.status,
1315
-