Remove exec() from atom.py

This commit is contained in:
Nathan Baker
2020-05-23 09:44:50 -07:00
parent 3cfcc8f6d3
commit e1656a4911

View File

@@ -290,8 +290,9 @@ class Atom(object):
self.occ = self.occ.replace('LG', 'non_titratable_ligand') self.occ = self.occ.replace('LG', 'non_titratable_ligand')
# try to initialise the group # try to initialise the group
try: try:
# TODO - get rid of this exec() statement for security reasons group_attr = "%s_group" % self.occ
exec('self.group = propka.group.%s_group(self)' % self.occ) group_attr = getattr(propka.group, group_attr)
self.group = group_attr(self)
except: except:
raise Exception('%s in input_file is not recognized as a group' % self.occ) raise Exception('%s in input_file is not recognized as a group' % self.occ)
# set the model pKa value # set the model pKa value