Exemplo n.º 1
0
def run_manager(config='udata.settings.Defaults'):
    app = create_app(config)
    app = standalone(app)
    set_logging(app)
    manager.app = app
    register_commands(manager)
    manager.run()
Exemplo n.º 2
0
def run_manager(config='udata.settings.Defaults'):
    app = create_app(config)
    app = standalone(app)
    set_logging(app)
    manager.app = app
    register_commands(manager)
    manager.run()
Exemplo n.º 3
0
def run_manager(config='udata.settings.Defaults'):
    app = create_app(config, init_logging=set_logging)
    app = standalone(app)
    manager.app = app
    register_commands(manager)
    try:
        manager.run()
    except InvalidCommand as err:
        print(err, file=sys.stderr)
        sys.exit(1)
Exemplo n.º 4
0
def create_cli_app(info):
    app = create_app(info.settings, init_logging=init_logging)
    return standalone(app)
Exemplo n.º 5
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging
import os

from PIL import Image

from udata.app import standalone, create_app

log = logging.getLogger(__name__)

app = standalone(create_app())


DEFAULT_SIZES = [128]  # , 25]
MAX = 10


def make_thumbnail(filename, size, crop=None):
    base, ext = os.path.splitext(filename)
    image = Image.open(filename)
    if crop:
        pass
    else:
        thumbnail = center_thumbnail(image, size)
    thumbnail.save(base + '-' + str(size) + ext)


def center_thumbnail(image, size):
    result = Image.new('RGBA', (size, size), (255, 255, 255, 0))
Exemplo n.º 6
0
import logging
import os

from PIL import Image

from udata.app import standalone, create_app

log = logging.getLogger(__name__)

app = standalone(create_app())

DEFAULT_SIZES = [128]  # , 25]
MAX = 10


def make_thumbnail(filename, size, crop=None):
    base, ext = os.path.splitext(filename)
    image = Image.open(filename)
    if crop:
        pass
    else:
        thumbnail = center_thumbnail(image, size)
    thumbnail.save(base + '-' + str(size) + ext)


def center_thumbnail(image, size):
    result = Image.new('RGBA', (size, size), (255, 255, 255, 0))
    if image.size[0] > image.size[1]:
        new_size = (size, image.size[1] * size / image.size[0])
    else:
        new_size = (image.size[0] * size / image.size[1], size)