def jsonItems(**kwargs): """ Serve JSON with all or filtered items. """ if not isAdmin() and not 'user_id' in kwargs: return showItems(json=True, user_id=session['user_id'], **kwargs) return showItems(json=True, **kwargs)
def showUserItem(user_id, item_id=None, **kwargs): """ Show user's items. """ if item_id: return showItem(user_id=user_id, item_id=item_id, **kwargs) return showItems(user_id=user_id, **kwargs)
def showUserCategory(user_id, category_id=None, **kwargs): """ Show the user categories. """ if category_id == 1: return showItems(user_id=user_id, category_id=category_id, **kwargs) if category_id: return showCategory(user_id=user_id, category_id=category_id, **kwargs) return showCategories(user_id=user_id, **kwargs)
def showUserCollection(user_id, collection_id=None, **kwargs): """ Show the user collections. """ if collection_id == 1: return showItems(user_id=user_id, collection_id=collection_id, **kwargs) if collection_id: return showCollection(user_id=user_id, collection_id=collection_id, **kwargs) return showCollections(user_id=user_id, **kwargs)
def showTag(tag, **kwargs): """ Show all the items for the selected tag. """ return showItems(tag=tag, **kwargs)
def showTags(**kwargs): """ Show all the tags. """ return showItems()