def hello():
    config = get_moksha_appconfig()
    socket = moksha.wsgi.widgets.api.get_moksha_socket(config)
    return flask.templating.render_template_string(
        simple_template,
        notification_widget=PopupNotification,
        moksha_socket=socket,
    )
Пример #2
0
    def __init__(self, app, config=None):
        """ Configuration arguments are documented in README.rst """

        self.app = app
        self.config = config

        if not self.config:
            self.config = get_moksha_appconfig()

        # Initialize fedmsg its own config in /etc/fedmsg.d/
        self.fedmsg_config = fedmsg.config.load_config(None, [])
        t.make_processors(**self.fedmsg_config)
Пример #3
0
        def __setup():

            if should_skip_config_set(name, config_set):
                raise unittest.SkipTest("%s is not available." % name)

            config = get_moksha_appconfig()

            for key in flash_keys:
                if key in config:
                    del config[key]

            for key, value in config_set.items():
                config[key] = value

            kernel(config)
    template = ""


@app.route("/")
def hello():
    config = get_moksha_appconfig()
    socket = moksha.wsgi.widgets.api.get_moksha_socket(config)
    return flask.templating.render_template_string(
        simple_template,
        notification_widget=PopupNotification,
        moksha_socket=socket,
    )


class HelloWorldProducer(moksha.hub.api.producer.PollingProducer):
    frequency = datetime.timedelta(seconds=2)

    def poll(self):
        self.send_message('hello_world', "Hello World!")


if __name__ == "__main__":
    # Load development.ini
    config = get_moksha_appconfig()

    # Wrap the inner wsgi app with our middlewares
    app.wsgi_app = make_moksha_middleware(app.wsgi_app, config)
    app.wsgi_app = make_middleware(app.wsgi_app)

    app.run(debug=True)