#NEWLINE# def dirlist_categories( request ) : #NEWLINE# #INDENT# r = [ '<ul class="jqueryFileTree" style="display: none;">' ] #NEWLINE# category = request . GET . get ( 'dir' , '' ) #NEWLINE# try : #NEWLINE# #INDENT# category = category . rstrip ( '/' ) #NEWLINE# c = category . split ( '/' ) #NEWLINE# category = ZornaNoteCategory . objects . get ( pk = int ( c [ ( - 1 ) ] ) , owner = request . user ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# category = None #NEWLINE# #UNINDENT# if category : #NEWLINE# #INDENT# ob_list = ZornaNoteCategory . objects . filter ( owner = request . user , parent = category ) #NEWLINE# pcat = ( '%s/' % category . pk ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ob_list = ZornaNoteCategory . objects . filter ( owner = request . user , parent__isnull = True ) #NEWLINE# pcat = '' #NEWLINE# #UNINDENT# for cat in ob_list : #NEWLINE# #INDENT# r . append ( ( '<li class="directory collapsed"><a href="#" id="%s" rel="%s%s/">%s</a></li>' % ( cat . pk , pcat , cat . pk , cat . name ) ) ) #NEWLINE# #UNINDENT# r . append ( '</ul>' ) #NEWLINE# return HttpResponse ( '' . join ( r ) )