If there is no items in the context, we still get a blank "place holder" in the page, that is mostly we don't need. I add several lines in the Navigation class, like below:
class Navigation(object):
def __init__(self, context, request):
self.context = context
self.request = request
self.location = 'top'
self.slot = getattr(self.request, 'kotti_slot', None)
# added by georgehu, to cancel the slot totally when we get a
# empty list of items
items = get_children(self.context, self.request, self.location)
if self.slot is not None and items:
self.location = self.slot
If there is no items in the context, we still get a blank "place holder" in the page, that is mostly we don't need. I add several lines in the Navigation class, like below:
class Navigation(object):