def get(self, request, uri): try: uri = self.decode_uri(uri) uri = URI(uri) plugins.resolve(uri) except UnknownPlugin: raise Http404 else: return self.render_plugin(request, self.get_context_data(uri=uri))
def test_resolve_plugin(self): with self.assertRaises(UnknownPlugin): plugins.get('xyz') plugin = plugins.resolve('i18n://sv-se@page/title.txt') self.assertIsInstance(plugin, TextPlugin) with self.assertRaises(UnknownPlugin): plugins.resolve('i18n://sv-se@page/title.foo')
def get(self, request, uri): try: uri = self.decode_uri(uri) uri = URI(uri) plugin = plugins.resolve(uri) plugin_context = self.get_context_data(uri=uri) if isinstance(plugin, DjediPlugin): plugin_context = plugin.get_editor_context(**plugin_context) except UnknownPlugin: raise Http404 else: return self.render_plugin(request, plugin_context)