Exemplo n.º 1
0
def item_xml(id):
    item = models.select_item_by_id(id)
    if item is not None:
        return utils.xml_response(utils.dict_to_xml('item', item.serialize),
                                  200)
    else:
        abort(404)
Exemplo n.º 2
0
def catalog_xml(catalog):
    c = models.select_catalog(catalog)
    if c is not None:
        return utils.xml_response(utils.dict_to_xml('catalog', c.serialize),
                                  200)
    else:
        abort(404)
Exemplo n.º 3
0
def catalogs_xml():
	'''
		Convert list of unserializable object to xml:
		1. Retrive data
		2. Turn each object to xml
		3. Wrap them with a xml tag
	'''
	return utils.xml_response(utils.list_to_xml('catalogs',
		[ utils.dict_to_xml('catalog', x.serialize) for x in models.select_catalogs_all() ]), 200)
Exemplo n.º 4
0
def catalogs_xml():
    '''
        Convert list of unserializable object to xml:
        1. Retrive data
        2. Turn each object to xml
        3. Wrap them with a xml tag
    '''
    return utils.xml_response(
        utils.list_to_xml('catalogs', [
            utils.dict_to_xml('catalog', x.serialize)
            for x in models.select_catalogs_all()
        ]), 200)
Exemplo n.º 5
0
def item_xml(id):
	item = models.select_item_by_id(id)
	if item is not None:
		return utils.xml_response(utils.dict_to_xml('item', item.serialize), 200)
	else:
		abort(404)
Exemplo n.º 6
0
def catalog_xml(catalog):
	c = models.select_catalog(catalog)
	if c is not None:
		return utils.xml_response(utils.dict_to_xml('catalog', c.serialize), 200)
	else:
		abort(404)
Exemplo n.º 7
0
def items_xml():
	return utils.xml_response(utils.list_to_xml('items',
		[ utils.dict_to_xml('item', x.serialize) for x in models.select_items_all() ]), 200)
Exemplo n.º 8
0
def items_xml():
    return utils.xml_response(
        utils.list_to_xml('items', [
            utils.dict_to_xml('item', x.serialize)
            for x in models.select_items_all()
        ]), 200)