13def resolveSGKey (flags, keystr):
14 """Pick proper SG key out of a list from ObjKeyStore.
15
16KEYSTR is a comma-separated list of StoreGate keys.
17Return the first one from that list that exists in the input.
18Raise an exception if none of them exist.
19"""
20
21 log = logging.getLogger ('D3PD')
22 kl = keystr.split(',')
23 for k in kl:
24 if k in flags.Input.Collections:
25 log.verbose ("Using SG key %s for type %s." % (k, type))
26 return k
27 if len (kl) == 1:
28
29 return k
30
31 raise Exception ("No keys among `%s' for type `%s' in ObjKeyStore." %
32 (keystr, type))
33
34
35