Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 1.02 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. def lookup(self, key, container_lookup=False):
  2.         """
  3.         For a simple key
  4.            workitem.lookup('toto')
  5.         is equivalent to
  6.            workitem.fields['toto']
  7.         but for a complex key
  8.            workitem.lookup('toto.address')
  9.         is equivalent to
  10.            workitem.fields['toto']['address']
  11.         """
  12.         ref=self._h['fields']
  13.         for k in key.split("."):
  14.             if not key in ref:
  15.                 return None
  16.             ref = ref[key]
  17.         return ref
  18.  
  19.  
  20.  
  21.     def lookup(self, key, container_lookup=False):
  22.         """
  23.         For a simple key
  24.            workitem.lookup('toto')
  25.         is equivalent to
  26.            workitem.fields['toto']
  27.         but for a complex key
  28.            workitem.lookup('toto.address')
  29.         is equivalent to
  30.            workitem.fields['toto']['address']
  31.         """
  32.         ref=self._h['fields']
  33.         for k in key.split("."):
  34.             if not k in ref:
  35.                 return None
  36.             ref = ref[key]
  37.         return ref