Exemplo n.º 1
0
setattr(leonardo, 'widgets', WIDGETS)

from leonardo.module.web.models import Page
from leonardo.module.web.widget import ApplicationWidget

# register external apps
Page.create_content_type(
    ApplicationWidget, APPLICATIONS=APPLICATION_CHOICES)

# register widgets
for _optgroup, _widgets in six.iteritems(WIDGETS):
    optgroup = _optgroup if _optgroup != 'ungrouped' else None
    for widget in _widgets:
        Page.create_content_type(widget, optgroup=optgroup)

Page.register_extensions(*PAGE_EXTENSIONS)
Page.register_default_processors(LEONARDO_FRONTEND_EDITING)

# FINALLY OVERRIDE ALL

try:
    # local settings
    from local_settings import *
except ImportError:
    warnings.warn(
        'Missing local_settings !')

try:
    # full settings
    from leonardo_site.local.settings import *
except ImportError:
Exemplo n.º 2
0
    for _optgroup, _widgets in six.iteritems(settings.WIDGETS):
        optgroup = _optgroup if _optgroup != 'ungrouped' else None
        for widget in _widgets:

            kwargs = {'optgroup': optgroup}

            # load class from strings
            if isinstance(widget, six.string_types):
                try:
                    WidgetCls = get_class_from_string(widget)
                except:
                    exc_info = sys.exc_info()
                    raise six.reraise(*exc_info)
            elif isinstance(widget, tuple):
                try:
                    WidgetCls = get_class_from_string(widget[0])
                    if len(widget) > 1:
                        kwargs.update(widget[1])
                except Exception as e:
                    raise Exception('%s: %s' % (mod, e))
            else:
                WidgetCls = widget

            Page.create_content_type(WidgetCls, **kwargs)


register_widgets()
Page.register_extensions(*settings.PAGE_EXTENSIONS)
Page.register_default_processors(True)
Exemplo n.º 3
0
    for _optgroup, _widgets in six.iteritems(settings.WIDGETS):
        optgroup = _optgroup if _optgroup != 'ungrouped' else None
        for widget in _widgets:

            kwargs = {'optgroup': optgroup}

            # load class from strings
            if isinstance(widget, six.string_types):
                try:
                    WidgetCls = get_class_from_string(widget)
                except Exception as e:
                    raise e
            elif isinstance(widget, tuple):
                try:
                    WidgetCls = get_class_from_string(widget[0])
                    if len(widget) > 1:
                        kwargs.update(widget[1])
                except Exception as e:
                    raise Exception('%s: %s' % (mod, e))
            else:
                WidgetCls = widget

            Page.create_content_type(
                WidgetCls, **kwargs)


register_widgets()
Page.register_extensions(*settings.PAGE_EXTENSIONS)
Page.register_default_processors(True)
Exemplo n.º 4
0
setattr(leonardo, 'widgets', WIDGETS)

from leonardo.module.web.models import Page
from leonardo.module.web.widget import ApplicationWidget

# register external apps
Page.create_content_type(
    ApplicationWidget, APPLICATIONS=APPLICATION_CHOICES)

# register widgets
for _optgroup, _widgets in six.iteritems(WIDGETS):
    optgroup = _optgroup if _optgroup != 'ungrouped' else None
    for widget in _widgets:
        Page.create_content_type(widget, optgroup=optgroup)

Page.register_extensions(*PAGE_EXTENSIONS)
Page.register_default_processors(LEONARDO_FRONTEND_EDITING)

# FINALLY OVERRIDE ALL

try:
    # local settings
    from local_settings import *
except ImportError:
    warnings.warn(
        'Missing local_settings !')

try:
    # full settings
    from leonardo_site.local.settings import *
except ImportError: