Ejemplo n.º 1
0
def latest(rebuild_website=True, quiet=False):
    import frappe.modules.patch_handler
    import frappe.model.sync
    from frappe.utils.fixtures import sync_fixtures
    import frappe.translate
    from frappe.core.doctype.notification_count.notification_count import clear_notifications

    verbose = not quiet

    frappe.connect()

    try:
        # run patches
        frappe.modules.patch_handler.run_all()
        # sync
        frappe.model.sync.sync_all(verbose=verbose)
        frappe.translate.clear_cache()
        sync_fixtures()

        clear_notifications()

        if rebuild_website:
            build_website()
    finally:
        frappe.destroy()
Ejemplo n.º 2
0
def clear_cache():
    import frappe.sessions
    from frappe.core.doctype.notification_count.notification_count import clear_notifications
    frappe.connect()
    frappe.clear_cache()
    clear_notifications()
    frappe.destroy()
Ejemplo n.º 3
0
    def on_update(self):
        # owner is always name
        frappe.db.set(self, 'owner', self.name)

        # clear new password
        new_password = self.new_password
        self.db_set("new_password", "")

        clear_notifications(user=self.name)
        frappe.clear_cache(user=self.name)

        try:
            if self.in_insert:
                if self.name not in STANDARD_USERS:
                    if new_password:
                        _update_password(self.name, new_password)

                    if not getattr(self, "no_welcome_mail", False):
                        self.send_welcome_mail()
                        msgprint(_("Welcome email sent"))
                        return
            else:
                self.email_new_password(new_password)

        except frappe.OutgoingEmailError:
            pass  # email server not set, don't send email
Ejemplo n.º 4
0
def clear_cache():
	import frappe.sessions
	from frappe.core.doctype.notification_count.notification_count import clear_notifications
	frappe.connect()
	frappe.clear_cache()
	clear_notifications()
	frappe.destroy()
Ejemplo n.º 5
0
def latest(rebuild_website=True, quiet=False):
	import frappe.modules.patch_handler
	import frappe.model.sync
	from frappe.utils.fixtures import sync_fixtures
	import frappe.translate
	from frappe.core.doctype.notification_count.notification_count import clear_notifications

	verbose = not quiet

	frappe.connect()

	try:
		# run patches
		frappe.modules.patch_handler.run_all()
		# sync
		frappe.model.sync.sync_all(verbose=verbose)
		frappe.translate.clear_cache()
		sync_fixtures()

		clear_notifications()

		if rebuild_website:
			build_website()
	finally:
		frappe.destroy()
Ejemplo n.º 6
0
	def on_update(self):
		# owner is always name
		frappe.db.set(self, 'owner', self.name)

		# clear new password
		new_password = self.new_password
		self.db_set("new_password", "")

		clear_notifications(user=self.name)
		frappe.clear_cache(user=self.name)

		try:
			if self.in_insert:
				if self.name not in STANDARD_USERS:
					if new_password:
						# new password given, no email required
						_update_password(self.name, new_password)
					if not getattr(self, "no_welcome_mail", False):
						self.send_welcome_mail()
						msgprint(_("Welcome email sent"))
						return
			else:
				self.email_new_password(new_password)

		except frappe.OutgoingEmailError:
			pass # email server not set, don't send email
Ejemplo n.º 7
0
def _clear_cache(parent):
	if parent in common_keys:
		frappe.clear_cache()
	else:
		clear_notifications(user=parent)
		frappe.clear_cache(user=parent)