[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 07:53:00 EST 2009
http://bugzilla.open-bio.org/show_bug.cgi?id=2967
------- 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
invalid
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
attributes
if name not in attr_whitelist: # If not in whitelist, treat
self.set_parameter(name, value) # as parameter
else:
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