def register():
    from yafowil.widget.cron import widget  # noqa
    factory.register_theme('default',
                           'yafowil.widget.cron',
                           resourcedir,
                           js=js,
                           css=default_css)
示例#2
0
def register():
    import widget
    factory.register_theme('default', 'yafowil.widget.slider',
                           resourcedir, js=js, css=default_css)
    factory.register_theme('bootstrap', 'yafowil.widget.slider',
                           resourcedir, js=js, css=bootstrap_css)
    factory.register_theme('plone5', 'yafowil.widget.slider',
                           resourcedir, js=js, css=plone5_css)
def register():
    from yafowil.widget.richtext import widget
    factory.register_theme('default', 'yafowil.widget.richtext',
                           resourcedir, js=js)
    factory.register_theme('plone4', 'yafowil.widget.richtext',
                           resourcedir, js=js_plone4)
    factory.register_theme('plone5', 'yafowil.widget.richtext',
                           resourcedir, js=js_plone5)
示例#4
0
def register():
    from yafowil.widget.datetime import widget
    factory.register_theme('default',
                           'yafowil.widget.datetime',
                           resourcedir,
                           js=js,
                           css=default_css)
    factory.register_theme('bootstrap',
                           'yafowil.widget.datetime',
                           resourcedir,
                           js=js,
                           css=bootstrap_css)
    factory.register_theme('plone5',
                           'yafowil.widget.datetime',
                           resourcedir,
                           js=js,
                           css=plone5_css)
def register():
    import widget
    factory.register_theme('default', 'yafowil.widget.alohaeditor',
                           resourcedir, js=js, css=css)
def register():
    import widget
    factory.register_theme('default', 'yafowil.widget.autocomplete',
                           resourcedir, js=js, css=default_css)
    factory.register_theme('bootstrap', 'yafowil.widget.autocomplete',
                           resourcedir, js=js, css=bootstrap_css)
def register():
    from yafowil.widget.recaptcha import widget
    factory.register_theme('default', 'yafowil.widget.recaptcha',
                           resourcedir, js=js)
示例#8
0
def register():
    import widget
    factory.register_theme('default', 'yafowil.widget.multiselect',
                           resourcedir, js=js, css=css)
示例#9
0
def register():
    from yafowil.plone import common  # noqa: E501
    factory.register_global_preprocessors([plone_preprocessor])
    factory.register_theme('plone5', 'yafowil.plone', resourcedir, css=css, js=js)
示例#10
0
def register():
    factory.register_theme('bootstrap', 'yafowil.bootstrap',
                           resourcedir, js=js, css=css)
示例#11
0
def register():
    import common
    factory.register_global_preprocessors([plone_preprocessor])
    factory.register_theme('plone5', 'yafowil.plone', resourcedir, css=css)
示例#12
0
def register():
    import widget
    factory.register_theme('default', 'yafowil.widget.richtext',
                           resourcedir, js=js)
示例#13
0
def register():
    import common
    factory.register_global_preprocessors([plone_preprocessor])
    factory.register_theme('plone5', 'yafowil.plone', resourcedir, css=css)
def register():
    from yafowil.widget.wysihtml5 import widget
    factory.register_theme('default', 'yafowil.widget.wysihtml5',
                           resourcedir, js=js, css=css)
def register():
    from yafowil.widget.multiselect import widget  # noqa
    factory.register_theme('default', 'yafowil.widget.multiselect',
                           resourcedir, js=js, css=css)
示例#16
0
def register():
    from yafowil.widget.dynatree import widget
    factory.register_theme('default', 'yafowil.widget.dynatree',
                           resourcedir, js=js, css=default_css)
    factory.register_theme('bootstrap', 'yafowil.widget.dynatree',
                           resourcedir, js=js, css=bootstrap_css)
def register():
    from yafowil.widget.location import widget
    factory.register_theme('default', 'yafowil.widget.location',
                           resourcedir, js=js, css=css)
示例#18
0
    def test_main(self):
        # main hook
        hooks = dict(called=0)

        def custom_main_hook(configurator, global_config, settings):
            hooks['called'] += 1

        cone.app.register_main_hook(custom_main_hook)

        @main_hook
        def decorated_main_hook(configurator, global_config, settings):
            hooks['called'] += 1

        # set auth tkt factory``
        factory = cone.app.auth_tkt_factory(secret='12345')
        self.assertTrue(isinstance(factory, AuthTktAuthenticationPolicy))

        # ACL factory
        factory = cone.app.acl_factory()
        self.assertTrue(isinstance(factory, ACLAuthorizationPolicy))

        # yafowil resources
        def dummy_get_plugin_names(ns=None):
            return ['yafowil.addon']

        get_plugin_names_origin = resources.get_plugin_names
        resources.get_plugin_names = dummy_get_plugin_names

        yafowil_addon_name = 'yafowil.addon'
        js = [{
            'group': 'yafowil.addon.common',
            'resource': 'widget.js',
            'order': 20,
        }]
        css = [{
            'group': 'yafowil.addon.common',
            'resource': 'widget.css',
            'order': 20,
        }]
        yafowil_factory.register_theme('default',
                                       yafowil_addon_name,
                                       'yafowil_addon_resources',
                                       js=js,
                                       css=css)

        # settings
        settings = {
            'cone.admin_user': '******',
            'cone.admin_password': '******',
            'cone.auth_secret': '12345',
            'cone.auth_reissue_time': '300',
            'cone.auth_max_age': '600',
            'cone.plugins': 'cone.app.tests'  # ensure dummy main hooks called
        }

        # main
        router = cone.app.main({}, **settings)
        self.assertTrue(isinstance(router, Router))
        self.assertEqual(hooks['called'], 2)

        # Remove custom main hook after testing
        cone.app.main_hooks.remove(custom_main_hook)
        cone.app.main_hooks.remove(decorated_main_hook)

        # Check created yafowil addon static view
        self.assertTrue(
            isinstance(cone.app.yafowil_addon_resources, static_view))

        # Remove dummy yafowil theme, reset get_plugin_names patch
        # and delete created yafowil addon static view
        resources.get_plugin_names = get_plugin_names_origin
        del yafowil_factory._themes['default'][yafowil_addon_name]
        del cone.app.yafowil_addon_resources
def register():
    import widget

    factory.register_theme("default", "yafowil.widget.wysihtml5", resourcedir, js=js, css=css)