From d726d20124beef9d53fc596aa9705cf135a4e485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 13 Dec 2015 17:02:25 +0100 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(-) diff --git a/wcs/workflows.py b/wcs/workflows.py index 64d02ef..fb35614 100644 --- a/wcs/workflows.py +++ b/wcs/workflows.py @@ -1257,6 +1257,17 @@ class WorkflowStatusItem(XmlSerialisable): def get_target_status(self): """Returns a list of status this item can lead to.""" + if not getattr(self, 'status', None): + return [] + + try: + return [x for x in self.parent.parent.possible_status if x.id == self.status] + except IndexError: + get_publisher().get_app_logger().error( + 'reference to invalid status in workflow %s, status %s, item %s' % ( + self.parent.parent.name, + self.parent.name, + self.description)) return [] def get_jump_label(self): @@ -1296,19 +1307,6 @@ class WorkflowStatusJumpItem(WorkflowStatusItem): status = None endpoint = False - def get_target_status(self): - if not self.status: - return [] - try: - return [x for x in self.parent.parent.possible_status if x.id == self.status] - except IndexError: - get_publisher().get_app_logger().error( - 'reference to invalid status in workflow %s, status %s, item %s' % ( - self.parent.parent.name, - self.parent.name, - self.description)) - return [] - def add_parameters_widgets(self, form, parameters, prefix='', formdef=None): if 'status' in parameters: form.add(SingleSelectWidget, '%sstatus' % prefix, title = _('Status'), value = self.status, -- 2.6.4