#NEWLINE# @ bp . route ( '/recordinfo' ) #NEWLINE# def get_record_info( ) : #NEWLINE# #INDENT# db = g . admin_context . pad . db #NEWLINE# tree_item = g . admin_context . tree . get ( request . args [ 'path' ] ) #NEWLINE# children = [ ] #NEWLINE# attachments = [ ] #NEWLINE# alts = [ ] #NEWLINE# for child in tree_item . iter_children ( ) : #NEWLINE# #INDENT# if child . is_attachment : #NEWLINE# #INDENT# attachments . append ( child ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# children . append ( child ) #NEWLINE# #UNINDENT# #UNINDENT# primary_alt = db . config . primary_alternative #NEWLINE# if ( primary_alt is not None ) : #NEWLINE# #INDENT# for alt in itervalues ( tree_item . alts ) : #NEWLINE# #INDENT# alt_cfg = db . config . get_alternative ( alt . id ) #NEWLINE# alts . append ( { #NEWLINE# #INDENT# 'alt' : alt . id , #NEWLINE# 'is_primary' : ( alt . id == PRIMARY_ALT ) , #NEWLINE# 'primary_overlay' : ( alt . id == primary_alt ) , #NEWLINE# 'name_i18n' : alt_cfg [ 'name' ] , #NEWLINE# 'exists' : alt . exists , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# return jsonify ( id = tree_item . id , path = tree_item . path , label_i18n = tree_item . label_i18n , exists = tree_item . exists , is_attachment = tree_item . is_attachment , attachments = [ { #NEWLINE# #INDENT# 'id' : x . id , #NEWLINE# 'path' : x . path , #NEWLINE# 'type' : x . attachment_type , #NEWLINE# #UNINDENT# } for x in attachments ] , children = [ { #NEWLINE# #INDENT# 'id' : x . id , #NEWLINE# 'path' : x . path , #NEWLINE# 'label' : x . id , #NEWLINE# 'label_i18n' : x . label_i18n , #NEWLINE# 'visible' : x . is_visible , #NEWLINE# #UNINDENT# } for x in children ] , alts = alts , can_have_children = tree_item . can_have_children , can_have_attachments = tree_item . can_have_attachments , can_be_deleted = tree_item . can_be_deleted )