Example #1
0
def clear_global_cache():
    frappe.model.meta.clear_cache()
    frappe.cache().delete_value([
        "app_hooks", "installed_apps", "app_modules", "module_app",
        "notification_config", 'system_settings'
    ])
    frappe.setup_module_map()
Example #2
0
def clear_global_cache():
    from frappe.website.render import clear_cache as clear_website_cache

    clear_doctype_cache()
    clear_website_cache()
    frappe.cache().delete_value(global_cache_keys)
    frappe.setup_module_map()
Example #3
0
def clear_global_cache():
    from frappe.website.utils import clear_website_cache

    clear_doctype_cache()
    clear_website_cache()
    frappe.cache().delete_value(global_cache_keys)
    frappe.cache().delete_value(bench_cache_keys)
    frappe.setup_module_map()
def execute():
	hr = frappe.db.get_value("Module Def", "HR")
	if hr == "Hr":
		frappe.rename_doc("Module Def", "Hr", "HR")
		frappe.db.set_value("Module Def", "HR", "module_name", "HR")

	frappe.clear_cache()
	frappe.setup_module_map()
def execute():
    hr = frappe.db.get_value("Module Def", "HR")
    if hr == "Hr":
        frappe.rename_doc("Module Def", "Hr", "HR")
        frappe.db.set_value("Module Def", "HR", "module_name", "HR")

    frappe.clear_cache()
    frappe.setup_module_map()
def clear_global_cache():
    frappe.model.meta.clear_cache()
    frappe.cache().delete_value([
        "app_hooks", "installed_apps", "app_modules", "module_app",
        "notification_config", 'system_settings', 'scheduler_events',
        'time_zone', 'webhooks', 'active_domains', 'active_modules'
    ])
    frappe.setup_module_map()
Example #7
0
def clear_global_cache():
	from frappe.website.render import clear_cache as clear_website_cache

	clear_doctype_cache()
	clear_website_cache()
	frappe.cache().delete_value(["app_hooks", "installed_apps",
		"app_modules", "module_app", "notification_config", 'system_settings',
		'scheduler_events', 'time_zone', 'webhooks', 'active_domains', 'active_modules'])
	frappe.setup_module_map()
Example #8
0
	def on_trash(self):
		"""Delete module name from modules.txt"""
		modules = None
		if frappe.local.module_app.get(frappe.scrub(self.name)):
			with open(frappe.get_app_path(self.app_name, "modules.txt"), "r") as f:
				content = f.read()
				if self.name in content.splitlines():
					modules = list(filter(None, content.splitlines()))
					modules.remove(self.name)

			if modules:
				with open(frappe.get_app_path(self.app_name, "modules.txt"), "w") as f:
					f.write("\n".join(modules))

				frappe.clear_cache()
				frappe.setup_module_map()
Example #9
0
	def add_to_modules_txt(self):
		"""Adds to `[app]/modules.txt`"""
		modules = None
		if not frappe.local.module_app.get(frappe.scrub(self.name)):
			with open(frappe.get_app_path(self.app_name, "modules.txt"), "r") as f:
				content = f.read()
				if not self.name in content.splitlines():
					modules = list(filter(None, content.splitlines()))
					modules.append(self.name)

			if modules:
				with open(frappe.get_app_path(self.app_name, "modules.txt"), "w") as f:
					f.write("\n".join(modules))

				frappe.clear_cache()
				frappe.setup_module_map()
Example #10
0
	def add_to_modules_txt(self):
		"""Adds to `[app]/modules.txt`"""
		modules = None
		if not frappe.local.module_app.get(frappe.scrub(self.name)):
			with open(frappe.get_app_path(self.app_name, "modules.txt"), "r") as f:
				content = f.read()
				if not self.name in content.splitlines():
					modules = list(filter(None, content.splitlines()))
					modules.append(self.name)

			if modules:
				with open(frappe.get_app_path(self.app_name, "modules.txt"), "w") as f:
					f.write("\n".join(modules))

				frappe.clear_cache()
				frappe.setup_module_map()
Example #11
0
	def validate(self):
		modules = None
		if not frappe.local.module_app.get(self.name):
			with open(frappe.get_app_path(self.app_name, "modules.txt"), "r") as f:
				content = f.read()
				if not frappe.scrub(self.name) in content.splitlines():
					modules = filter(None, content.splitlines())
					modules.append(frappe.scrub(self.name))

			if modules:
				with open(frappe.get_app_path(self.app_name, "modules.txt"), "w") as f:
					f.write("\n".join(modules))

				frappe.clear_cache()
				frappe.setup_module_map()

		module_path = frappe.get_app_path(self.app_name, self.name)
		if not os.path.exists(module_path):
			os.mkdir(module_path)
			with open(os.path.join(module_path, "__init__.py"), "w") as f:
				f.write("")
Example #12
0
    def on_trash(self):
        """Delete module name from modules.txt"""

        if not frappe.conf.get(
                'developer_mode') or frappe.flags.in_uninstall or self.custom:
            return

        modules = None
        if frappe.local.module_app.get(frappe.scrub(self.name)):
            with open(frappe.get_app_path(self.app_name, "modules.txt"),
                      "r") as f:
                content = f.read()
                if self.name in content.splitlines():
                    modules = list(filter(None, content.splitlines()))
                    modules.remove(self.name)

            if modules:
                with open(frappe.get_app_path(self.app_name, "modules.txt"),
                          "w") as f:
                    f.write("\n".join(modules))

                frappe.clear_cache()
                frappe.setup_module_map()
Example #13
0
	def validate(self):
		if not frappe.conf.get("developer_mode"):
			return

		modules = None
		if not frappe.local.module_app.get(frappe.scrub(self.name)):
			with open(frappe.get_app_path(self.app_name, "modules.txt"), "r") as f:
				content = f.read()
				if not self.name in content.splitlines():
					modules = filter(None, content.splitlines())
					modules.append(self.name)

			if modules:
				with open(frappe.get_app_path(self.app_name, "modules.txt"), "w") as f:
					f.write("\n".join(modules))

				frappe.clear_cache()
				frappe.setup_module_map()

		module_path = frappe.get_app_path(self.app_name, self.name)
		if not os.path.exists(module_path):
			os.mkdir(module_path)
			with open(os.path.join(module_path, "__init__.py"), "w") as f:
				f.write("")
			self.add_to_modules_txt()

	def create_modules_folder(self):
		"""Creates a folder `[app]/[module]` and adds `__init__.py`"""
		module_path = frappe.get_app_path(self.app_name, self.name)
		if not os.path.exists(module_path):
			os.mkdir(module_path)
			with open(os.path.join(module_path, "__init__.py"), "w") as f:
				f.write("")

	def add_to_modules_txt(self):
		"""Adds to `[app]/modules.txt`"""
		modules = None
		if not frappe.local.module_app.get(frappe.scrub(self.name)):
			with open(frappe.get_app_path(self.app_name, "modules.txt"), "r") as f:
				content = f.read()
				if not self.name in content.splitlines():
<<<<<<< HEAD
					modules = filter(None, content.splitlines())
=======
					modules = list(filter(None, content.splitlines()))
>>>>>>> 176d241496ede1357a309fa44a037b757a252581
					modules.append(self.name)

			if modules:
				with open(frappe.get_app_path(self.app_name, "modules.txt"), "w") as f:
					f.write("\n".join(modules))

				frappe.clear_cache()
				frappe.setup_module_map()
Example #15
0
def clear_global_cache():
	frappe.model.meta.clear_cache()
	frappe.cache().delete_value(["app_hooks", "installed_apps",
		"app_modules", "module_app", "time_zone", "notification_config"])
	frappe.setup_module_map()
Example #16
0
def clear_global_cache():
	frappe.model.meta.clear_cache()
	frappe.cache().delete_value(["app_hooks", "installed_apps", "app_modules", "module_app"])
	frappe.setup_module_map()
Example #17
0
def clear_global_cache():
	frappe.model.meta.clear_cache()
	frappe.cache().delete_value(["app_hooks", "installed_apps",
		"app_modules", "module_app", "notification_config", 'system_settings'
		'scheduler_events', 'time_zone'])
	frappe.setup_module_map()