MCPcopy Index your code
hub / github.com/WebODM/WebODM / app_view_handler

Function app_view_handler

app/plugins/views.py:23–45  ·  view source on GitHub ↗
(request, plugin_name=None)

Source from the content-addressed store, hash-verified

21 return (None, None, None)
22
23def 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
48def api_view_handler(request, plugin_name=None):

Callers

nothing calls this directly

Calls 8

get_plugin_by_nameFunction · 0.85
try_resolve_urlFunction · 0.85
existsMethod · 0.80
get_pathMethod · 0.80
serve_public_assetsMethod · 0.80
viewFunction · 0.50
app_mount_pointsMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected