Example #1
0
def get_images_for_category(category_id):
    ''' 
        Retrieves images for a given category
    '''
    # FIXME lorempixum
    n = Random().randint(8, 20);
    contents = []
    for i in range(0, n):
        c = ImageModel()
        c.title = get_random_text(Random().randint(5, 25)).replace('\n', '').replace('\r', '')
        c.description = get_random_text(Random().randint(45, 325))
        c.height = MAX_HEIGHT
        c.width = Random().randint(300, MAX_WIDTH)
        c.image_blob_key = 'pixum'
        c = c.jsond()
        c['id'] = i
        contents += [c]
        pass
#    contents = [c.jsond() for c in ImageModel.all().filter('category_id', category_id).filter('visible', True)]
    return contents 
    pass