Ticket #2397 (closed: invalid)

Opened 10 years ago

Last modified 5 years ago

Validators do not work in python algorithms

Reported by: Peter Peterson Owned by: Peter Peterson
Priority: major Milestone: Release 2.1
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Andrei Savici

Description

While the validators themselves appear to be created in python, they don't seem to validate. The algorithms continue to run even when provided parameters are bad. Here is a small example algorithm

from MantidFramework import *

class BrokenAlgorithm(PythonAlgorithm):
    def name(self):
        return "BrokenAlgorithm"

    def PyInit(self):
        self.declareListProperty("Array", [0], Validator=ArrayBoundedValidator(Lower=0))
        self.declareProperty("Scalar", 0, Validator=BoundedValidator(Lower=0))

    def PyExec(self):
        print "Array:", self.getProperty("Array")
        print "Scalar:", self.getProperty("Scalar")

mtd.registerPyAlgorithm(BrokenAlgorithm())

Change History

comment:1 Changed 10 years ago by Peter Peterson

  • Status changed from new to accepted
  • Owner set to Peter Peterson

comment:2 Changed 10 years ago by Peter Peterson

(In [9418]) The validator wasn't being passed to the algorithm parent. Refs #2397.

comment:3 Changed 10 years ago by Nick Draper

  • Milestone changed from Iteration 27 to Iteration 28

Bulk move of tickets at the end of iteration 27

comment:4 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 28 to Iteration 29

Bulk move of tickets at the end of iteration 28

comment:5 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 29 to Iteration 30

Accepted and assigned tickets moved at iteration 29 code freeze

comment:6 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 30 to Iteration 31

Bulk move of tickets to iteration 31 at the iteration 30 code freeze

comment:7 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 32 to Iteration 33

Moved to iteration 33 at iteration 32 code freeze

comment:8 Changed 8 years ago by Peter Peterson

  • Status changed from accepted to verify
  • Resolution set to invalid

Just looking at old tickets I tried this out again and everything works.

comment:9 Changed 8 years ago by Andrei Savici

  • Status changed from verify to verifying
  • Tester set to Andrei Savici

comment:10 Changed 8 years ago by Andrei Savici

  • Status changed from verifying to closed

Works in the new python api as well.

comment:11 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 3244

Note: See TracTickets for help on using tickets.