def get_handler(app): return h_cases( h_static_files(app.cfg.STATIC_DIR, app.cfg.STATIC_URL), h_static_files(app.cfg.MEDIA_DIR, app.cfg.MEDIA_URL), h_match('/', name='index') | h_index, h_404, )
def h_subsections(self, section): handlers = [] if section is None: subsections = [] else: subsections = self.get_sections(section['children']) for subsection in subsections: if not subsection: continue view = self.views[subsection['type']] handler = view.handler(self, subsection) handlers.append(handler) return h_cases(*handlers)
def h_subsections(self, section): handlers = [] if section is None: subsections = [] else: subsections = self.get_sections(section['children']) for subsection in subsections: if not subsection: continue path = '.'.join(subsection['path']) view = self.custom_views.get(path) if not view: view = self.views[subsection['type']] handler = view.handler(self, subsection) handlers.append(handler) return h_cases(*handlers)
def get_handler(app): return h_cases( h_static_files(app.cfg.STATIC_DIR, app.cfg.STATIC_URL), h_static_files(app.cfg.MEDIA_DIR, app.cfg.MEDIA_URL), h_index, )
def handler(cls, component, section): slug = section['slug'] return h_prefix('/' + slug, name=slug) | \ HView(cls, component=component, section=section) | \ h_cases(*cls.cases(component, section))