~vishvananda/nova/has_role_cache

Viewing all changes in revision 724.

  • Committer: Tarmac
  • Author(s): Justin Santa Barbara
  • Date: 2011-02-23 22:50:33 UTC
  • mfrom: (700.5.7 mini-xpath)
  • Revision ID: tarmac-20110223225033-cv15qx87ycl52h1t
Helper function that supports XPath style selectors to traverse an object tree e.g.

inst = {'fixed_ip': {'floating_ips': [{'address': '1.2.3.4'}], 'address': '192.168.0.3'}, 'hostname': ''}

private_ips = get_from_path(inst, 'fixed_ip/address')
public_ips = get_from_path(inst, 'fixed_ip/floating_ips/address')

Avoids messy [.get() / if / for]* nested code

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: