def load(cls, location_id): if location_id not in LOCATIONS: info = util.deserialize(r.get(location_id)) session_key = kvs.get('session_key_' + location_id) info['session_key'] = session_key location = cls(**info) LOCATIONS[location_id] = location return LOCATIONS[location_id]
def register(ctx, parsed): who = parsed.get('self') if not who: return existing_dsa_pub = kvs.get('dsa_pub_' + who) if existing_dsa_pub: raise exception.Error('already registered') dsa_pub = parsed.get('args') dsa_pub_key = crypt.PublicVerifierKey.from_key('dsa_pub_' + who, dsa_pub) dsa_pub_key.save() ctx.reply(parsed, response='ok')