[Biopython-dev] [Bug 2967] AbstractCommandline silently accepts invalid parameter options

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Dec 9 12:53:00 UTC 2009


------- Comment #5 from lpritc at scri.sari.ac.uk  2009-12-09 07:53 EST -------
This works for me, at the moment:

    def __setattr__(self, name, value):
        """ Workaround for a user interface issue.  Without this __setattr__
            attribute-based assignment of parameters will silently accept
            parameters, leading to known instances of the user assuming that 
            parameters for the application are set, when they are not.
            This workaround uses a whitelist of object attributes, and 
            sets the object attribute list as normal, for these.  Other
            attributes are assumed to be parameters, and passed to the 
            self.set_parameter method for validation and assignment.
        attr_whitelist = ['parameters', 'program_name']     # Allowed
        if name not in attr_whitelist:       # If not in whitelist, treat
            self.set_parameter(name, value)  # as parameter
            self.__dict__[name] = value

Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the Biopython-dev mailing list