#NEWLINE# @ throws_when_stopped #NEWLINE# def create( self , path , data = '' , ephemeral = False , makepath = False ) : #NEWLINE# #INDENT# "Create a znode.\n\n        Args:\n            path: The path to this node.\n            data: The data associated with this node, currently not in use.\n            ephemeral: Whether this node is an ephemeral node or not.\n            makepath: Whether to make the path if not existing already. Set\n                to True, if creating all the znodes along the path if not\n                existing is desired.\n\n        Throws:\n            NoNodeException, when makepath is False, and the parent node\n            doesn't already exist.\n\n        " #NEWLINE# if ( not path . startswith ( '/' ) ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Path has to be absolute.' ) #NEWLINE# #UNINDENT# parent_path = path [ : path . rfind ( '/' ) ] #NEWLINE# child_name = path [ ( path . rfind ( '/' ) + 1 ) : ] #NEWLINE# parent_node = self . _find ( parent_path ) #NEWLINE# ensure_path_called = False #NEWLINE# if ( parent_node is None ) : #NEWLINE# #INDENT# if ( not makepath ) : #NEWLINE# #INDENT# raise NoNodeException ( "%s doesn't exist" , parent_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . ensure_path ( parent_path ) #NEWLINE# parent_node = self . _find ( parent_path ) #NEWLINE# ensure_path_called = True #NEWLINE# #UNINDENT# #UNINDENT# assert ( not parent_node . ephemeral ) #NEWLINE# parent_node . add_child ( child_name , data , ephemeral = ephemeral ) #NEWLINE# if ( not ensure_path_called ) : #NEWLINE# #INDENT# self . _notify_children_watches ( str ( parent_node ) )