Exemplo n.º 1
0
def categoryModel():
    try:
        categories = models.load_categories()
        if categories is None:
            abort(403)
        else:
            return jsonify(categories=[r.serialize for r in categories])
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Exemplo n.º 2
0
def categoryModel():
    try:
        categories = models.load_categories()
        if categories is None:
            abort(403)
        else:
            return jsonify(categories=[r.serialize for r in categories])
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Exemplo n.º 3
0
def categoryModel():
    try:
        categories = models.load_categories()
        if categories is None:
            abort(403)
        else:
            return utilities.status(utilities.convert_list_to_xml('categories',
                                                                  [utilities.convert_object_to_xml('category',
                                                                                                   r.serialize) for r in categories]), 200, 'xml')
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Exemplo n.º 4
0
def categoryModel():
    try:
        categories = models.load_categories()
        if categories is None:
            abort(403)
        else:
            return utilities.status(
                utilities.convert_list_to_xml('categories', [
                    utilities.convert_object_to_xml('category', r.serialize)
                    for r in categories
                ]), 200, 'xml')
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Exemplo n.º 5
0
def categoryModel():
    try:
        categories = models.load_categories()
        if categories is None:
            abort(403)
        else:
            feed = utilities.create_feed('categories', request)
            for category in categories:
                feed.add(category.id,
                         category.name,
                         id=category.id,
                         content_type='html',
                         updated=category.created_at,
                         published=category.updated_at or category.created_at)

            return feed.get_response()
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Exemplo n.º 6
0
def categoryModel():
    try:
        categories = models.load_categories()
        if categories is None:
            abort(403)
        else:
            feed = utilities.create_feed('categories', request)
            for category in categories:
                feed.add(
                    category.id,
                    category.name,
                    id=category.id,
                    content_type='html',
                    updated=category.created_at,
                    published=category.updated_at or category.created_at)

            return feed.get_response()
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)