#NEWLINE# def add_tag( plugin_id , tag ) : #NEWLINE# #INDENT# '\n    Add all tags to relevant lists.\n    ' #NEWLINE# with db . common . connect ( ) as con : #NEWLINE# #INDENT# if ( r . table ( 'tags' ) . get ( tag ) . run ( con ) is None ) : #NEWLINE# #INDENT# r . table ( 'tags' ) . insert ( { #NEWLINE# #INDENT# 'tag' : tag , #NEWLINE# 'plugins' : [ plugin_id ] , #NEWLINE# #UNINDENT# } ) . run ( con ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# r . table ( 'tags' ) . get ( tag ) . update ( { #NEWLINE# #INDENT# 'plugins' : ( r . row [ 'plugins' ] + [ plugin_id ] ) , #NEWLINE# #UNINDENT# } ) . run ( con )