Exemplo n.º 1
0
def clear_cache(user=None, doctype=None):
    """Clear **User**, **DocType** or global cache.

	:param user: If user is given, only user cache is cleared.
	:param doctype: If doctype is given, only DocType cache is cleared."""
    import frappe.sessions

    if doctype:
        import frappe.model.meta

        frappe.model.meta.clear_cache(doctype)
        reset_metadata_version()
    elif user:
        frappe.sessions.clear_cache(user)
    else:  # everything
        import translate

        frappe.sessions.clear_cache()
        translate.clear_cache()
        reset_metadata_version()
        frappe.local.cache = {}

        for fn in frappe.get_hooks("clear_cache"):
            get_attr(fn)()

    frappe.local.role_permissions = {}
Exemplo n.º 2
0
def clear_cache(user=None, doctype=None):
    """Clear **User**, **DocType** or global cache.

	:param user: If user is given, only user cache is cleared.
	:param doctype: If doctype is given, only DocType cache is cleared."""
    import frappe.sessions
    if doctype:
        import frappe.model.meta
        frappe.model.meta.clear_cache(doctype)
        reset_metadata_version()
    elif user:
        frappe.sessions.clear_cache(user)
    else:  # everything
        import translate
        frappe.sessions.clear_cache()
        translate.clear_cache()
        reset_metadata_version()
        clear_domainification_cache()
        local.cache = {}
        local.new_doc_templates = {}

        for fn in get_hooks("clear_cache"):
            get_attr(fn)()

    local.role_permissions = {}
Exemplo n.º 3
0
def clear_cache(user=None, doctype=None):
	"""clear cache"""
	import frappe.sessions
	if doctype:
		import frappe.model.meta
		frappe.model.meta.clear_cache(doctype)
		reset_metadata_version()
	elif user:
		frappe.sessions.clear_cache(user)
	else: # everything
		import translate
		frappe.sessions.clear_cache()
		translate.clear_cache()
		reset_metadata_version()
Exemplo n.º 4
0
def clear_cache(user=None, doctype=None):
	"""clear cache"""
	import webnotes.sessions
	if doctype:
		import webnotes.model.doctype
		webnotes.model.doctype.clear_cache(doctype)
		reset_metadata_version()
	elif user:
		webnotes.sessions.clear_cache(user)
	else: # everything
		import translate
		webnotes.sessions.clear_cache()
		translate.clear_cache()
		reset_metadata_version()
Exemplo n.º 5
0
def clear_cache(user=None, doctype=None):
	"""clear cache"""
	import frappe.sessions
	if doctype:
		import frappe.model.doctype
		frappe.model.doctype.clear_cache(doctype)
		reset_metadata_version()
	elif user:
		frappe.sessions.clear_cache(user)
	else: # everything
		import translate
		frappe.sessions.clear_cache()
		translate.clear_cache()
		reset_metadata_version()
Exemplo n.º 6
0
def clear_cache(user=None, doctype=None):
    """clear cache"""
    import frappe.sessions
    if doctype:
        import frappe.model.meta
        frappe.model.meta.clear_cache(doctype)
        reset_metadata_version()
    elif user:
        frappe.sessions.clear_cache(user)
    else:  # everything
        import translate
        frappe.sessions.clear_cache()
        translate.clear_cache()
        reset_metadata_version()

        for fn in frappe.get_hooks("clear_cache"):
            get_attr(fn)()

    frappe.local.role_permissions = {}
Exemplo n.º 7
0
def clear_cache(user=None, doctype=None):
	"""clear cache"""
	import frappe.sessions
	if doctype:
		import frappe.model.meta
		frappe.model.meta.clear_cache(doctype)
		reset_metadata_version()
	elif user:
		frappe.sessions.clear_cache(user)
	else: # everything
		import translate
		frappe.sessions.clear_cache()
		translate.clear_cache()
		reset_metadata_version()

		for fn in frappe.get_hooks("clear_cache"):
			get_attr(fn)()

	frappe.local.role_permissions = {}