Exemple #1
0
 def _get(prefix, cmp2, checkdate):
     xn = utils.list_flatten(sources, lambda e: getattr(e, prefix + suffix).all())
     # print '_onoff._get', cmp2, xn
     def _filter(e):
         return cmp2 >= e.start and cmp2 <= e.end and (not e.date or e.date == dtdate if checkdate else True)
     return utils.list_last(sorted(
         [ e for e in xn if _filter(e) ],
         key = lambda e: e.start,
     ))
Exemple #2
0
 def get_forms_reps(self, **kwargs):
     locs = self.locs.all()
     loccats = utils.list_flatten(locs, lambda loc: loc.cats.all())
     return Form.get_forms_reps(
         baseuser = self,
         user = self,
         loccats = loccats,
         usercats = self.allcats(),
         **kwargs
     )
Exemple #3
0
 def _node_data(_node):
     d = cached.get(_node)
     iscached = d is not None
     if not iscached:
         _upnodes = utils.tree_ups(_node)
         _itemcats = utils.tree_all_downs(utils.list_flatten(_upnodes, lambda enode: enode.itemcats.all()))
         d = dict(
             upnodes = _upnodes,
             itemcats = _itemcats,
             items = ItemCat.els_get(_itemcats),
         )
         cached[_node] = d
     # print '_node_data cached', iscached, _node, d
     return d