#NEWLINE# @ must_be_contributor_or_public #NEWLINE# @ must_have_addon ( 'badges' , 'node' ) #NEWLINE# def badges_widget( * args , **kwargs ) : #NEWLINE# #INDENT# node = ( kwargs [ 'node' ] or kwargs [ 'project' ] ) #NEWLINE# auth = kwargs [ 'auth' ] #NEWLINE# ret = { #NEWLINE# #INDENT# 'complete' : True , #NEWLINE# 'assertions' : get_node_badges ( node ) , #NEWLINE# #UNINDENT# } #NEWLINE# if auth . user : #NEWLINE# #INDENT# badger = auth . user . get_addon ( 'badges' ) #NEWLINE# if badger : #NEWLINE# #INDENT# ret . update ( badger . to_json ( args . user ) ) #NEWLINE# ret [ 'uid' ] = auth . user . _id #NEWLINE# #UNINDENT# #UNINDENT# ret . update ( kwargs [ 'node_addon' ] . config . to_json ( ) ) #NEWLINE# return ret