#NEWLINE# def read( self , request , username ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# user = User . objects . get ( username = username ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# resp = rc . NOT_HERE #NEWLINE# resp . write ( ': User does not exist.' ) #NEWLINE# return resp #NEWLINE# #UNINDENT# snipts = Snippet . objects . filter ( user = user . id , public = '1' ) #NEWLINE# tags = Tag . objects . usage_for_queryset ( snipts , counts = True ) #NEWLINE# tags_list = [ ] #NEWLINE# snipts_list = [ ] #NEWLINE# for tag in tags : #NEWLINE# #INDENT# tags_list . append ( { #NEWLINE# #INDENT# 'id' : tag . id , #NEWLINE# 'name' : tag . name , #NEWLINE# 'count' : tag . count , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# for snipt in snipts : #NEWLINE# #INDENT# snipts_list . append ( snipt . id ) #NEWLINE# #UNINDENT# data = { #NEWLINE# #INDENT# 'username' : user . username , #NEWLINE# 'id' : snipts . id , #NEWLINE# 'tags' : tags_list , #NEWLINE# 'snipts' : snipts_list , #NEWLINE# 'count' : snipts . count ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# return data