nodes: 0, module; 1, function_definition; 2, function_name:rejectionOptionsList; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# RejectionReasons will return something like:; 10, comment:# [{'checkbox': u'on', 'textfield-2': u'b', 'textfield-1': u'c', 'textfield-0': u'a'}]; 11, if_statement; 12, expression_statement; 13, if_statement; 14, comment:# Building the list with the values only because the keys are not needed any more; 15, expression_statement; 16, for_statement; 17, return_statement; 18, string:"Return a sorted list with the options defined in bikasetup"; 19, assignment; 20, assignment; 21, comparison_operator:len(settings.RejectionReasons) > 0; 22, block; 23, else_clause; 24, assignment; 25, comparison_operator:'checkbox' in sorted_keys; 26, block; 27, assignment; 28, identifier:key; 29, identifier:sorted_keys; 30, block; 31, identifier:items; 32, identifier:plone; 33, call; 34, identifier:settings; 35, attribute; 36, call; 37, integer:0; 38, expression_statement; 39, block; 40, identifier:sorted_keys; 41, call; 42, string; 43, identifier:sorted_keys; 44, expression_statement; 45, identifier:items; 46, list; 47, expression_statement; 48, identifier:getSite; 49, argument_list; 50, identifier:plone; 51, identifier:bika_setup; 52, identifier:len; 53, argument_list; 54, assignment; 55, return_statement; 56, identifier:sorted; 57, argument_list; 58, string_content:checkbox; 59, call; 60, call; 61, attribute; 62, identifier:reject_reasons; 63, subscript; 64, list; 65, call; 66, attribute; 67, argument_list; 68, attribute; 69, argument_list; 70, identifier:settings; 71, identifier:RejectionReasons; 72, attribute; 73, integer:0; 74, attribute; 75, argument_list; 76, identifier:sorted_keys; 77, identifier:remove; 78, string; 79, identifier:items; 80, identifier:append; 81, call; 82, identifier:settings; 83, identifier:RejectionReasons; 84, identifier:reject_reasons; 85, identifier:keys; 86, string_content:checkbox; 87, attribute; 88, argument_list; 89, subscript; 90, identifier:strip; 91, identifier:reject_reasons; 92, identifier:key
code: def rejectionOptionsList(self):
          "Return a sorted list with the options defined in bikasetup"
          plone = getSite()
          settings = plone.bika_setup
          # RejectionReasons will return something like:
          # [{'checkbox': u'on', 'textfield-2': u'b', 'textfield-1': u'c', 'textfield-0': u'a'}]
          if len(settings.RejectionReasons) > 0:
              reject_reasons = settings.RejectionReasons[0]
          else:
              return []
          sorted_keys = sorted(reject_reasons.keys())
          if 'checkbox' in sorted_keys:
              sorted_keys.remove('checkbox')
          # Building the list with the values only because the keys are not needed any more
          items = []
          for key in sorted_keys:
              items.append(reject_reasons[key].strip())
          return items