def sitemap(self): """Return a sitemap""" content = sitemap_tpl.format(pages='\n'.join( url_tpl.format(page=page) for page in sorted(get_pages(), key=lambda a: a.path) if not page.exclude_from_sitemap)) return zoom.response.TextResponse(content)
def home(): title = cfg_get("AppTitle") pages = [] is_admin = current_user.has_group("admins") if is_admin: pages.append((url_for('handle_users'), "Manage Users")) pg = get_pages() for p in pg: page = get_page(p) if current_user.has_groups(page.ACL): pages.append((url_for('render_page', htmlfile=page.template), page.description)) return render_template('home.html', title=title, pages=pages)
""" Dash app """ from dash.dependencies import Input, Output from pages import get_pages from dash_app import create_dash_app # Create dash app with styles APP = create_dash_app() SERVER = APP.server # Add pages with content, sidebar and callbacks PAGES = get_pages(APP) @APP.callback(Output("body", "children"), [Input("url", "pathname")]) # pylint: disable=unused-variable def display_content(pathname): """Updates content based on current page""" if pathname in PAGES: return PAGES[pathname].get_body_html() return "404" @APP.callback(Output("filters", "children"), [Input("url", "pathname")]) # pylint: disable=unused-variable def display_filters(pathname): """ Updates content based on current page """
quoting=csv.QUOTE_ALL) asinlist = [row[0] for row in csvread] else: with open(mf, 'wb') as o: csvwrite = csv.writer(o, delimiter=';', quotechar='"', quoting=csv.QUOTE_ALL) csvwrite.writerow(['asin', 'author', 'title', 'pages']) for dirpath, dirs, files in os.walk(docs): for file in files: file_extension = os.path.splitext(file)[1].lower() if file_extension not in ['.mobi', '.azw', '.azw3']: continue print('* Processing: ' + file.decode( sys.getfilesystemencoding() ) + '...') row = get_pages(dirpath, file) if row is None: continue if row[0] in asinlist: continue with open(mf, 'ab') as o: csvwrite = csv.writer(o, delimiter=';', quotechar='"', quoting=csv.QUOTE_ALL) csvwrite.writerow(row) print('* Dumping completed...') else: extract_cover_thumbs(args.silent, args.overwrite_pdoc_thumbs, args.overwrite_amzn_thumbs, args.overwrite_apnx, args.skip_apnx, kindlepth, docs, args.azw, args.days) if sys.platform == 'darwin':