def __get_previous_sibling(self): if self.node.parent is None: return None index = self.node.parent.get_index(self.node) if index == 0: return None sibling_name = self.node.parent.children_names()[index - 1] return IDomNode(self.node.parent.get_child(sibling_name))
def __get_parent_node(self): if self.node.parent is None: return None try: parent = IDomNode(self.node.parent) except TypeError, error: print 'IDomNode(node.parent) failed: ' + str(error) print '\treturning None for parent.' parent = None
def __get_next_sibling(self): if self.node.parent is None: return None index = self.node.parent.get_index(self.node) names = self.node.parent.children_names() sibling_index = index + 1 if sibling_index >= len(names): return None sibling_name = names[sibling_index] return IDomNode(self.node.parent.get_child(sibling_name))
def handle_request(self, request): user = request.user_object() response = Response(request) node = self.get_node(request.get_path()) try: domnode = IDomNode(node) webnode = IWebContent(domnode) except ComponentLookupError, error: response['Content-Type'] = 'text/plain' response.send_error(404, 'No adapter for requested node.')
def getElementById(self, id): """ ID is the node URL. """ return IDomNode(self.nodespace.as_node(id))
def __get_document_element(self): # Root is this object's node. return IDomNode(self.node)
def __get_last_child(self): child = self.node.get_child(self.node.children_names()[-1]) return IDomNode(child)