Ejemplo n.º 1
0
 def __call__(self):
     fieldname = self.request.get('fieldname')
     field = self.context.Schema()[fieldname]
     tree = lookupVocabulary(self.context, field)        
     selected = self.request.get('selected', []).split('|')
     return JSONWriter().write(dict2dynatree(tree, selected, 
                                             field.widget.leafsOnly,
                                             field.widget.showKey))
Ejemplo n.º 2
0
 def __call__(self):
     fieldname = self.request.get('fieldname')
     field = self.context.Schema()[fieldname]
     tree = lookupVocabulary(self.context, field)
     selected = self.request.get('selected', '').split('|')
     return json.dumps(
         dict2dynatree(
             self.context,
             tree,
             selected,
             field.widget.leafsOnly,
             field.widget.showKey
         )
     )
Ejemplo n.º 3
0
 def vocabLookup(self, instance, field, value):
     tree = lookupVocabulary(instance, field)
     def find(treepart):
         if treepart is None:
             return None
         if value in treepart:
             return treepart[value][0]
         for key in treepart.keys():
             result = find(treepart[key][1])
             if result is not None:
                 return result
         return None
     result = find(tree)
     if result is None:
          return u'NOT FOUND'
     return result