예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
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"))
예제 #4
0
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()
예제 #6
0
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"))
예제 #7
0
파일: fixtures.py 프로젝트: lowks/frappe
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)
예제 #8
0
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)
예제 #9
0
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()
예제 #10
0
파일: cli.py 프로젝트: 81552433qqcom/frappe
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()