Example #1
0
def download_button():
    from allura import model as M
    from allura.lib.widgets.macros import DownloadButton
    button = DownloadButton(project=c.project)
    g.resource_manager.register(button)
    response = button.display(project=c.project)
    return response
Example #2
0
def download_button():
    from allura import model as M
    from allura.lib.widgets.macros import DownloadButton
    button = DownloadButton(project=c.project)
    g.resource_manager.register(button)
    response = button.display(project=c.project)
    return response
Example #3
0
def download_button():
    from allura.lib.widgets.macros import DownloadButton
    button = DownloadButton(project=c.project)
    try:
        res_mgr = g.resource_manager
    except TypeError:
        # e.g. "TypeError: No object (name: widget_context) has been registered for this thread"
        # this is an ugly way to check to see if we're outside of a web request and avoid errors
        return '[[download_button]]'
    else:
        res_mgr.register(button)
        response = button.display(project=c.project)
        return response
Example #4
0
def download_button():
    from allura.lib.widgets.macros import DownloadButton
    button = DownloadButton(project=c.project)
    try:
        res_mgr = g.resource_manager
    except TypeError:
        # e.g. "TypeError: No object (name: widget_context) has been registered for this thread"
        # this is an ugly way to check to see if we're outside of a web request and avoid errors
        return '[[download_button]]'
    else:
        res_mgr.register(button)
        response = button.display(project=c.project)
        return response