def empty_listing(*things): parent_name = None for t in things: try: parent_name = t.parent_name break except AttributeError: continue l = Listing(None, None, parent_name = parent_name) l.things = list(things) return Wrapped(l)
def add_child_listing(parent, *things): l = Listing(None, nextprev=None) l.things = list(things) parent.child = Wrapped(l) parent_name = parent._fullname if not parent.deleted else "deleted" parent.child.parent_name = parent_name