예제 #1
0
def index(request):
    load_settings(request)
    
    # Populate the widget library
    library = []
    css_files = set()
    js_files = set()
    for name, plugin in sorted(plugin_registry.iteritems()):
        for css in plugin['instance'].css():
            css_files.add(LinkData(name=plugin['name'], path=plugin['namespace'] + '/' + css))
        for js in plugin['instance'].js():
            js_files.add(LinkData(name=plugin['name'], path=plugin['namespace'] + '/' + js))
        output = render_widget(request, {'type': name, 'id': 'library-'+name, 'library': True})
        library.append({'output': output, 'name': name})
    
    # Render all the widgets we need
    for row in request.grid:
        for widget_opts in row:
            widget_opts['output'] = render_widget(request, widget_opts, css_files, js_files)
    data = {'grid': request.grid, 'library': library, 'css': css_files, 'js': js_files}
    return TemplateResponse(request, 'index.html', data)
예제 #2
0
def plugin_ticks(frequency):
    log = plugin_ticks.get_logger()
    for name, plugin in plugin_registry.iteritems():
        if hasattr(plugin['instance'], 'tick_%s'%frequency):
            log.debug('Queueing tick_%s task for plugin %s', frequency, name)
            plugin_tick.apply_async(args=[frequency, name])
예제 #3
0
from django.conf.urls.defaults import patterns, url, include

from statusboard.plugins import plugin_registry

urlpatterns = patterns('')
for name, data in plugin_registry.iteritems():
    if data['urls']:
        urlpatterns.append(url(name+'/', include(data['urls'])))