[Pyme-help] contants -> constant names? for info
Status: Beta
Brought to you by:
belyi
From: Bernhard R. <ber...@in...> - 2008-08-13 12:43:59
|
Hi Igor, I am starting to wonder if it would be practical to have a conversion function that will return the name of the constant from its value. When trying to interpret key.owner_trust or uid.validity, e.g. as in key = c.get_key(keyfpr, False) print "got key: ", key.subkeys[0].fpr, "owner_trust:", key.owner_trust for uid in key.uids: print uid.uid, "validity:", uid.validity from pyme.constants import validity gives me the constants, but from there it is difficult to contract their name. I could use the information from dir(validity) ['FULL', 'MARGINAL', 'NEVER', 'ULTIMATE', 'UNDEFINED', 'UNKNOWN', '__builtins__', '__doc__', '__file__', '__name__', 'util'] but this would not be conclusive as there could be more integers in there. So in the end I would need to make my own list of the six values, which is not helpful. Why not have process_constants() create a sole table as well? I think there are quite a few use cases for this. Especially when trying to print extra information about what has happened, this is in the debug case, but also in the general "verbose" information case. Best, Bernhard -- Managing Director - Owner: www.intevation.net (Free Software Company) Germany Coordinator: fsfeurope.org. Coordinator: www.Kolab-Konsortium.com. Intevation GmbH, Osnabrück, DE; Amtsgericht Osnabrück, HRB 18998 Geschäftsführer Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner |