#NEWLINE# def get( ) : #NEWLINE# #INDENT# 'get session boot info' #NEWLINE# from frappe.desk.notifications import get_notification_info_for_boot , get_notifications #NEWLINE# from frappe.boot import get_bootinfo #NEWLINE# bootinfo = None #NEWLINE# if ( not getattr ( frappe . conf , 'disable_session_cache' , None ) ) : #NEWLINE# #INDENT# bootinfo = frappe . cache ( ) . hget ( 'bootinfo' , frappe . session . user ) #NEWLINE# if bootinfo : #NEWLINE# #INDENT# bootinfo [ 'from_cache' ] = 1 #NEWLINE# bootinfo [ 'notification_info' ] . update ( get_notifications ( ) ) #NEWLINE# bootinfo [ 'user' ] [ 'recent' ] = json . dumps ( frappe . cache ( ) . hget ( 'user_recent' , frappe . session . user ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not bootinfo ) : #NEWLINE# #INDENT# bootinfo = get_bootinfo ( ) #NEWLINE# bootinfo [ 'notification_info' ] = get_notification_info_for_boot ( ) #NEWLINE# frappe . cache ( ) . hset ( 'bootinfo' , frappe . session . user , bootinfo ) #NEWLINE# try : #NEWLINE# #INDENT# frappe . cache ( ) . ping ( ) #NEWLINE# #UNINDENT# except redis . exceptions . ConnectionError : #NEWLINE# #INDENT# message = _ ( 'Redis cache server not running. Please contact Administrator / Tech support' ) #NEWLINE# if ( 'messages' in bootinfo ) : #NEWLINE# #INDENT# bootinfo [ 'messages' ] . append ( message ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# bootinfo [ 'messages' ] = [ message ] #NEWLINE# #UNINDENT# #UNINDENT# if frappe . local . request : #NEWLINE# #INDENT# bootinfo [ 'change_log' ] = get_change_log ( ) #NEWLINE# #UNINDENT# #UNINDENT# bootinfo [ 'metadata_version' ] = frappe . cache ( ) . get_value ( 'metadata_version' ) #NEWLINE# if ( not bootinfo [ 'metadata_version' ] ) : #NEWLINE# #INDENT# bootinfo [ 'metadata_version' ] = frappe . reset_metadata_version ( ) #NEWLINE# #UNINDENT# for hook in frappe . get_hooks ( 'extend_bootinfo' ) : #NEWLINE# #INDENT# frappe . get_attr ( hook ) ( bootinfo = bootinfo ) #NEWLINE# #UNINDENT# bootinfo [ 'lang' ] = frappe . translate . get_user_lang ( ) #NEWLINE# bootinfo [ 'disable_async' ] = frappe . conf . disable_async #NEWLINE# return message