コード例 #1
0
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])
コード例 #2
0
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])
コード例 #3
0
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)
コード例 #4
0
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)