def get_notifications_for_doctypes(config, notification_count):
 can_read = frappe.get_user().get_can_read()
 open_count_doctype = {}
 for d in config.for_doctype:
  if (d in can_read):
   condition = config.for_doctype[d]
   if (d in notification_count):
    open_count_doctype[d] = notification_count[d]
   else:
    try:
     if isinstance(condition, dict):
      result = len(frappe.get_list(d, fields=[u'name'], filters=condition, limit_page_length=100, as_list=True, ignore_ifnull=True))
     else:
      result = frappe.get_attr(condition)()
    except frappe.PermissionError:
     pass
    except Exception as e:
     if (e.args[0] != 1412):
      raise
    else:
     open_count_doctype[d] = result
     frappe.cache().hset((u'notification_count:' + d), frappe.session.user, result)
 return open_count_doctype

def get_notifications_for_doctypes ( config , notification_count ) : can_read = frappe . get_user ( ) . get_can_read ( ) open_count_doctype = { } for d in config . for_doctype : if ( d in can_read ) : condition = config . for_doctype [ d ] if ( d in notification_count ) : open_count_doctype [ d ] = notification_count [ d ] else : try : if isinstance ( condition , dict ) : result = len ( frappe . get_list ( d , fields = [ u'name' ] , filters = condition , limit_page_length = 100 , as_list = True , ignore_ifnull = True ) ) else : result = frappe . get_attr ( condition ) ( ) except frappe . PermissionError : pass except Exception as e : if ( e . args [ 0 ] != 1412 ) : raise else : open_count_doctype [ d ] = result frappe . cache ( ) . hset ( ( u'notification_count:' + d ) , frappe . session . user , result ) return open_count_doctype
notifications for doctypes .