Ejemplo n.º 1
0
def imagesModel(category_id = None):
    try:
        images=None
        if (category_id is None):
            images=models.load_all_images()
        else:
            images=models.load_all_images_by_category(category_id)

        if images is None:
            abort(403)
        else:
            feed = utilities.create_feed('images', request);
            for image in images:
                feed.add(
                    image.id,
                    image.path,
                    id=image.id,
                    content_type='html',
                    updated=image.created_at,
                    published=image.updated_at or image.created_at)
            return feed.get_response()
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Ejemplo n.º 2
0
def imagesModel(category_id=None):
    try:
        images = None
        if (category_id is None):
            images = models.load_all_images()
        else:
            images = models.load_all_images_by_category(category_id)

        if images is None:
            abort(403)
        else:
            return jsonify(images=[r.serialize for r in images])
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Ejemplo n.º 3
0
def imagesModel(category_id=None):
    try:
        images = None
        if (category_id is None):
            images = models.load_all_images()
        else:
            images = models.load_all_images_by_category(category_id)

        if images is None:
            abort(403)
        else:
            return jsonify(images=[r.serialize for r in images])
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Ejemplo n.º 4
0
def imagesModel(category_id=None):
    try:
        images = None
        if (category_id is None):
            images = models.load_all_images()
        else:
            images = models.load_all_images_by_category(category_id)

        if images is None:
            abort(403)
        else:
            return utilities.status(utilities.convert_list_to_xml('images',
                                                                  [utilities.convert_object_to_xml('image',
                                                                                                   r.serialize) for r in images]), 200, 'xml')
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Ejemplo n.º 5
0
def imagesModel(category_id=None):
    try:
        images = None
        if (category_id is None):
            images = models.load_all_images()
        else:
            images = models.load_all_images_by_category(category_id)

        if images is None:
            abort(403)
        else:
            return utilities.status(
                utilities.convert_list_to_xml('images', [
                    utilities.convert_object_to_xml('image', r.serialize)
                    for r in images
                ]), 200, 'xml')
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)
Ejemplo n.º 6
0
def imagesModel(category_id=None):
    try:
        images = None
        if (category_id is None):
            images = models.load_all_images()
        else:
            images = models.load_all_images_by_category(category_id)

        if images is None:
            abort(403)
        else:
            feed = utilities.create_feed('images', request)
            for image in images:
                feed.add(image.id,
                         image.path,
                         id=image.id,
                         content_type='html',
                         updated=image.created_at,
                         published=image.updated_at or image.created_at)
            return feed.get_response()
    except:
        print "Unexpected error:", sys.exc_info()[0]
        print "Unexpected error:", sys.exc_info()[1]
        abort(403)