def get_bootinfo(): """build and return boot info""" bootinfo = webnotes._dict() hooks = webnotes.get_hooks() doclist = [] # profile get_profile(bootinfo) # control panel cp = webnotes.model.doc.getsingle('Control Panel') # system info bootinfo['control_panel'] = webnotes._dict(cp.copy()) bootinfo['sysdefaults'] = webnotes.defaults.get_defaults() bootinfo['server_date'] = webnotes.utils.nowdate() bootinfo["send_print_in_body_and_attachment"] = webnotes.conn.get_value("Email Settings", None, "send_print_in_body_and_attachment") if webnotes.session['user'] != 'Guest': bootinfo['user_info'] = get_fullnames() bootinfo['sid'] = webnotes.session['sid']; # home page bootinfo.modules = {} for app in webnotes.get_installed_apps(): try: bootinfo.modules.update(webnotes.get_attr(app + ".config.desktop.data") or {}) except ImportError, e: pass
def get_app_list(): out = {} installed = webnotes.get_installed_apps() for app in webnotes.get_all_apps(True): out[app] = {} app_hooks = webnotes.get_hooks(app_name=app) for key in ("app_name", "app_title", "app_description", "app_icon", "app_publisher", "app_version", "app_url", "app_color"): val = app_hooks.get(key) or [] out[app][key] = val[0] if len(val) else "" if app in installed: out[app]["installed"] = 1 return out
def rebuild_website_sitemap_config(): # TODO webnotes.flags.in_rebuild_config = True webnotes.conn.sql("""delete from `tabWebsite Sitemap Config`""") for app in webnotes.get_installed_apps(): build_website_sitemap_config(app) cleanup_sitemap() webnotes.flags.in_rebuild_config = False # enable nested set and rebuild rebuild_tree("Website Sitemap", "parent_website_sitemap") webnotes.conn.commit()
def run_all_tests(app=None, verbose=False): import os apps = [app] if app else webnotes.get_installed_apps() test_suite = unittest.TestSuite() for app in apps: for path, folders, files in os.walk(webnotes.get_pymodule_path(app)): for dontwalk in ('locals', '.git', 'public'): if dontwalk in folders: folders.remove(dontwalk) # print path for filename in files: filename = cstr(filename) if filename.startswith("test_") and filename.endswith(".py"): # print filename[:-3] _run_test(path, filename, verbose, test_suite=test_suite, run=False) return unittest.TextTestRunner(verbosity=1+(verbose and 1 or 0)).run(test_suite)
def get_all_patches(): patches = [] for app in webnotes.get_installed_apps(): patches.extend(webnotes.get_file_items(webnotes.get_pymodule_path(app, "patches.txt"))) return patches
def sync_all(force=0): for app in webnotes.get_installed_apps(): sync_for(app, force) webnotes.clear_cache()