Example #1
0
 def prepend(self, k, *args, **kw):
     args = conv.flatten(list(args))
     args = [a for a in args if a != ""]
     if k in self:
         if not isinstance(self[k], list):
             self[k] = conv.to_list(self[k])
         self[k] = list(args) + self[k]
     elif len(args) == 1:
         if kw.get("make_list", False):
             self[k] = [args[0]]
         else:
             self[k] = args[0]
     elif len(args) > 1:
         self[k] = list(args)
 def prepend(self, k, *args, **kw):
     args = conv.flatten(list(args))
     args = [a for a in args if a != ""]
     if k in self:
         if not isinstance(self[k], list):
             self[k] = conv.to_list(self[k])
         self[k] = list(args) + self[k]
     elif len(args) == 1:
         if kw.get("make_list", False):
             self[k] = [args[0]]
         else:
             self[k] = args[0]
     elif len(args) > 1:
         self[k] = list(args)
Example #3
0
 def append(self, k, *args, **kw):
     args = conv.flatten(list(args))
     args = [a for a in args if a != ""]
     if isinstance(k, (dict, Environment)):
         self._handle_dict(k, self.append, **kw)
     else:
         if k in self:
             if not isinstance(self[k], list):
                 self[k] = conv.to_list(self[k])
             self[k] += list(args)
         elif len(args) == 1:
             if kw.get("make_list", False):
                 self[k] = [args[0]]
             else:
                 self[k] = args[0]
         elif len(args) > 1:
             self[k] = list(args)
 def append(self, k, *args, **kw):
     args = conv.flatten(list(args))
     args = [a for a in args if a != ""]
     if isinstance(k, (dict, Environment)):
         self._handle_dict(k, self.append, **kw)
     else:
         if k in self:
             if not isinstance(self[k], list):
                 self[k] = conv.to_list(self[k])
             self[k] += list(args)
         elif len(args) == 1:
             if kw.get("make_list", False):
                 self[k] = [args[0]]
             else:
                 self[k] = args[0]
         elif len(args) > 1:
             self[k] = list(args)
Example #5
0
 def prepend_unique(self, k, *args, **kw):
     args = conv.flatten(list(args))
     self.prepend(k, *self._make_unique(k, args), **kw)
Example #6
0
 def append_unique(self, k, *args, **kw):
     args = conv.flatten(list(args))
     if isinstance(k, (dict, Environment)):
         self._handle_dict(k, self.append_unique, **kw)
     else:
         self.append(k, *self._make_unique(k, args), **kw)
 def prepend_unique(self, k, *args, **kw):
     args = conv.flatten(list(args))
     self.prepend(k, *self._make_unique(k, args), **kw)
 def append_unique(self, k, *args, **kw):
     args = conv.flatten(list(args))
     if isinstance(k, (dict, Environment)):
         self._handle_dict(k, self.append_unique, **kw)
     else:
         self.append(k, *self._make_unique(k, args), **kw)