(request, plugin_name=None)
| 21 | return (None, None, None) |
| 22 | |
| 23 | def app_view_handler(request, plugin_name=None): |
| 24 | plugin = get_plugin_by_name(plugin_name) # TODO: this pings the server, which might be bad for performance with very large amount of files |
| 25 | if plugin is None: |
| 26 | raise Http404("Plugin not found") |
| 27 | |
| 28 | # Try mountpoints first |
| 29 | for mount_point in plugin.app_mount_points(): |
| 30 | view, args, kwargs = try_resolve_url(request, url(r'^/plugins/{}/{}'.format(plugin_name, mount_point.url), |
| 31 | mount_point.view, |
| 32 | *mount_point.args, |
| 33 | **mount_point.kwargs)) |
| 34 | if view: |
| 35 | return view(request, *args, **kwargs) |
| 36 | |
| 37 | # Try public assets |
| 38 | if os.path.exists(plugin.get_path("public")) and plugin.serve_public_assets(request): |
| 39 | view, args, kwargs = try_resolve_url(request, url('^/plugins/{}/(.*)'.format(plugin_name), |
| 40 | serve, |
| 41 | {'document_root': plugin.get_path("public")})) |
| 42 | if view: |
| 43 | return view(request, *args, **kwargs) |
| 44 | |
| 45 | raise Http404("No valid routes") |
| 46 | |
| 47 | |
| 48 | def api_view_handler(request, plugin_name=None): |
nothing calls this directly
no test coverage detected