Skip to content

Instantly share code, notes, and snippets.

@zindel
Created February 16, 2016 10:19
Show Gist options
  • Save zindel/039fa223f3dd19d8e760 to your computer and use it in GitHub Desktop.
Save zindel/039fa223f3dd19d8e760 to your computer and use it in GitHub Desktop.
diff -r 89fbe7517b6f src/rex/widget_chrome/access.py
--- a/src/rex/widget_chrome/access.py Tue Feb 16 12:08:45 2016 +0300
+++ b/src/rex/widget_chrome/access.py Tue Feb 16 11:19:16 2016 +0100
@@ -1,4 +1,4 @@
-from rex.core import Initialize, get_settings, cached
+from rex.core import Initialize, get_settings, cached, get_packages
from rex.web import route, Authorize
from rex.urlmap import Override
from rex.action.map import ActionRenderer
@@ -37,10 +37,15 @@
if is_external(item.url):
continue
handler = route(item.url)
- assert handler is not None, \
+ assert handler is not None or self.is_static_file(item.url), \
('Cannot find handler for the URL: %s. '
'Check your "menu" setting.') % item.url
access = access_map.get(item.access)
assert access is not None, \
('Permission "%s" for the URL: %s cannot be found. '
'Check your "menu" setting.') % (item.access, item.url)
+
+ def is_static_file(self, url):
+ package_name, file = url.split(':', 1)
+ package = get_packages()[package_name]
+ return package.exists('/www' + file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment