def update_unread_queries(inbox_rels, insert=True, mutator=None):
 if (not mutator):
  m = CachedQueryMutator()
 else:
  m = mutator
 inbox_rels = tup(inbox_rels)
 for inbox_rel in inbox_rels:
  thing = inbox_rel._thing2
  user = inbox_rel._thing1
  if isinstance(thing, Comment):
   if (inbox_rel._name == 'inbox'):
    query = get_unread_comments(user._id)
   elif (inbox_rel._name == 'selfreply'):
    query = get_unread_selfreply(user._id)
   elif (inbox_rel._name == 'mention'):
    query = get_unread_comment_mentions(user._id)
  elif isinstance(thing, Message):
   query = get_unread_messages(user._id)
  else:
   raise ValueError(("can't handle %s" % thing.__class__.__name__))
  if insert:
   m.insert(query, [inbox_rel])
  else:
   m.delete(query, [inbox_rel])
 if (not mutator):
  m.send()

def update_unread_queries ( inbox_rels , insert = True , mutator = None ) : if ( not mutator ) : m = CachedQueryMutator ( ) else : m = mutator inbox_rels = tup ( inbox_rels ) for inbox_rel in inbox_rels : thing = inbox_rel . _thing2 user = inbox_rel . _thing1 if isinstance ( thing , Comment ) : if ( inbox_rel . _name == 'inbox' ) : query = get_unread_comments ( user . _id ) elif ( inbox_rel . _name == 'selfreply' ) : query = get_unread_selfreply ( user . _id ) elif ( inbox_rel . _name == 'mention' ) : query = get_unread_comment_mentions ( user . _id ) elif isinstance ( thing , Message ) : query = get_unread_messages ( user . _id ) else : raise ValueError ( ( "can't handle %s" % thing . __class__ . __name__ ) ) if insert : m . insert ( query , [ inbox_rel ] ) else : m . delete ( query , [ inbox_rel ] ) if ( not mutator ) : m . send ( )
update all the cached queries related to the inbox relations .