def showCategoryJSON(category_id):
    """
	Get a single category in JSON format.
	
	URLs:
		'/catalog/category/<int:category_id>/JSON/'
	
	Args:
		category_id: The id of the catagory to get
	"""

    category = readCategory(category_id)
    if category == None:
        return showError("There is no category with id=%s" % category_id)
    items = readItems(category_id)
    return jsonify(items=[i.serialize for i in items])
def showCategoryJSON(category_id):
	"""
	Get a single category in JSON format.
	
	URLs:
		'/catalog/category/<int:category_id>/JSON/'
	
	Args:
		category_id: The id of the catagory to get
	"""

	category = readCategory(category_id)
	if category == None:
		return showError("There is no category with id=%s" % category_id)
	items = readItems(category_id)
	return jsonify(items=[i.serialize for i in items])
def showCategory(category_id):
	"""
	Show all the items in a category, given a category id.
	
	URLs:
		'/catalog/category/<int:category_id>/'
	
	Args:
		category_id: The id of the category to show
	"""

	category = readCategory(category_id)
	if category == None:
		return showError("There is no category with id=%s" % category_id)
	items = readItems(category_id)
	if 'username' not in login_session:
		return render_template('public_show_category.html', items = items, 
			category=category)
	else:
		return render_template('show_category.html', items=items, 
			category=category)
def showCategory(category_id):
    """
	Show all the items in a category, given a category id.
	
	URLs:
		'/catalog/category/<int:category_id>/'
	
	Args:
		category_id: The id of the category to show
	"""

    category = readCategory(category_id)
    if category == None:
        return showError("There is no category with id=%s" % category_id)
    items = readItems(category_id)
    if 'username' not in login_session:
        return render_template('public_show_category.html',
                               items=items,
                               category=category)
    else:
        return render_template('show_category.html',
                               items=items,
                               category=category)