Esempio n. 1
0
from autonomie import forms
from autonomie.forms.custom_types import QuantityType
from autonomie.forms import (
    files,
    lists,
)
from autonomie.utils.image import (
    ImageResizer,
    ImageRatio,
)

log = logging.getLogger(__name__)

HEADER_RATIO = ImageRatio(4, 1)
HEADER_RESIZER = ImageResizer(2000, 500)


@colander.deferred
def deferred_edit_adminonly_widget(node, kw):
    """
        return a deferred adminonly edit widget
    """
    request = kw['request']
    if not request.has_permission('admin_company', request.context):
        return deform_extensions.DisabledInput()
    else:
        return deform.widget.TextInputWidget()


@colander.deferred
Esempio n. 2
0
import deform_extensions
from deform import FileData

from autonomie.models.company import CompanyActivity

from autonomie.forms.validators import validate_image_mime
from autonomie import forms
from autonomie.forms import (
    files,
    lists,
)
from autonomie.utils.image import ImageResizer

log = logging.getLogger(__name__)

HEADER_RESIZER = ImageResizer(4, 1)


@colander.deferred
def deferred_edit_adminonly_widget(node, kw):
    """
        return a deferred adminonly edit widget
    """
    request = kw['request']
    if not request.has_permission('admin_company', request.context):
        return deform_extensions.DisabledInput()
    else:
        return deform.widget.TextInputWidget()


@colander.deferred
Esempio n. 3
0
def resizer():
    return ImageResizer(800, 200)