def export_data(dt): if not isinstance(dt, (tuple, list)): dt = [dt] for doctype in dt: filters = None if isinstance(doctype, (tuple, list)): doctype, filters = doctype export_json(doctype, get_json_path(doctype), filters=filters)
def export_data(dt): if not isinstance(dt, (tuple, list)): dt = [dt] for doctype in dt: filters=None if isinstance(doctype, (tuple, list)): doctype, filters = doctype export_json(doctype, get_json_path(doctype), filters=filters)
def export_fixtures(): """Export fixtures as JSON to `[app]/fixtures`""" for app in frappe.get_installed_apps(): for fixture in frappe.get_hooks("fixtures", app_name=app): print "Exporting {0}".format(fixture) if not os.path.exists(frappe.get_app_path(app, "fixtures")): os.mkdir(frappe.get_app_path(app, "fixtures")) export_json(fixture, frappe.get_app_path(app, "fixtures", frappe.scrub(fixture) + ".json"))
def export_json(context, doctype, name, path): "Export doclist as json to the given path, use '-' as name for Singles." from frappe.core.page.data_import_tool import data_import_tool for site in context.sites: try: frappe.init(site=site) frappe.connect() data_import_tool.export_json(doctype, path, name=name) finally: frappe.destroy()
def export_json(context, doctype, name, path): "Export doclist as json to the given path, use '-' as name for Singles." from frappe.core.page.data_import_tool import data_import_tool for site in context.sites: try: frappe.init(site=site) frappe.connect() data_import_tool.export_json(doctype, path, name=name) finally: frappe.destroy()
def export_fixtures(): for app in frappe.get_installed_apps(): for fixture in frappe.get_hooks("fixtures", app_name=app): print "Exporting {0}".format(fixture) if not os.path.exists(frappe.get_app_path(app, "fixtures")): os.mkdir(frappe.get_app_path(app, "fixtures")) export_json( fixture, frappe.get_app_path(app, "fixtures", frappe.scrub(fixture) + ".json"))
def export_fixtures(): """Export fixtures as JSON to `[app]/fixtures`""" for app in frappe.get_installed_apps(): for fixture in frappe.get_hooks("fixtures", app_name=app): filters = None if isinstance(fixture, dict): filters = fixture.get("filters") fixture = fixture.get("doctype") or fixture.get("dt") print "Exporting {0} app {1} filters {2}".format(fixture, app, filters) if not os.path.exists(frappe.get_app_path(app, "fixtures")): os.mkdir(frappe.get_app_path(app, "fixtures")) export_json(fixture, frappe.get_app_path(app, "fixtures", frappe.scrub(fixture) + ".json"), filters=filters)
def export_fixtures(): """Export fixtures as JSON to `[app]/fixtures`""" for app in frappe.get_installed_apps(): for fixture in frappe.get_hooks("fixtures", app_name=app): filters = None if isinstance(fixture, dict): filters = fixture.get("filters") fixture = fixture.get("doctype") or fixture.get("dt") print "Exporting {0} app {1} filters {2}".format( fixture, app, filters) if not os.path.exists(frappe.get_app_path(app, "fixtures")): os.mkdir(frappe.get_app_path(app, "fixtures")) export_json(fixture, frappe.get_app_path(app, "fixtures", frappe.scrub(fixture) + ".json"), filters=filters)
def export_doclist(doctype, name, path): from frappe.core.page.data_import_tool import data_import_tool frappe.connect() data_import_tool.export_json(doctype, name, path) frappe.destroy()
def export_doclist(doctype, name, path): from frappe.core.page.data_import_tool import data_import_tool frappe.connect() data_import_tool.export_json(doctype, name, path) frappe.destroy()