#NEWLINE# def get( self , path = None , persist = True ) : #NEWLINE# #INDENT# 'Returns a path item at the given node.' #NEWLINE# path = ( '/' + ( path or '' ) . strip ( '/' ) ) #NEWLINE# alts = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# exists = False #NEWLINE# first_record = None #NEWLINE# label_i18n = None #NEWLINE# for alt in chain ( [ PRIMARY_ALT ] , self . pad . db . config . list_alternatives ( ) ) : #NEWLINE# #INDENT# record = self . pad . get ( path , alt = alt , persist = persist , allow_virtual = False ) #NEWLINE# if ( first_record is None ) : #NEWLINE# #INDENT# first_record = record #NEWLINE# #UNINDENT# if ( record is not None ) : #NEWLINE# #INDENT# exists = True #NEWLINE# #UNINDENT# alts [ alt ] = Alt ( alt , record ) #NEWLINE# #UNINDENT# is_visible = True #NEWLINE# is_attachment = False #NEWLINE# attachment_type = None #NEWLINE# can_have_children = False #NEWLINE# can_have_attachments = False #NEWLINE# can_be_deleted = ( exists and ( path != '/' ) ) #NEWLINE# if ( first_record is not None ) : #NEWLINE# #INDENT# is_attachment = is_visible . is_attachment #NEWLINE# is_visible = first_record . is_visible #NEWLINE# dm = first_record . datamodel #NEWLINE# if ( not is_attachment ) : #NEWLINE# #INDENT# can_have_children = dm . has_own_children #NEWLINE# can_have_attachments = dm . has_own_attachments #NEWLINE# if dm . protected : #NEWLINE# #INDENT# can_be_deleted = False #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# attachment_type = ( first_record [ '_attachment_type' ] or None ) #NEWLINE# #UNINDENT# label_i18n = first_record . get_record_label_i18n ( ) #NEWLINE# #UNINDENT# return TreeItem ( self , path , alts , exists , is_attachment = is_attachment , attachment_type = attachment_type , can_have_children = can_have_children , can_have_attachments = can_have_attachments , can_be_deleted = can_be_deleted , is_visible = is_visible , label_i18n = label_i18n )