Revision: 2528
Author: janne.t.harkonen
Date: Wed Feb 24 23:44:01 2010
Log: whitespace
http://code.google.com/p/robotframework/source/detail?r=2528
Modified:
/trunk/src/robot/utils/abstractdomwrapper.py
=======================================
--- /trunk/src/robot/utils/abstractdomwrapper.py Sun Apr 19 13:26:54 2009
+++ /trunk/src/robot/utils/abstractdomwrapper.py Wed Feb 24 23:44:01 2010
@@ -17,9 +17,9 @@
class AbstractDomWrapper:
-
+
"""Base class for pydomwrapper.DomWrapper and
jydomwrapper.DomWrapper"""
-
+
def __init__(self, path):
"""Public attributes. These must be set by extending classes."""
self.source = path
@@ -27,20 +27,20 @@
self.attrs = {}
self.text = ''
self.children = []
-
+
def _get_root(self, path, string):
node = self._get_dom(path, string).firstChild
# Ignore comments, doctypes, etc. before root node
- while node.nodeType != node.ELEMENT_NODE:
+ while node.nodeType != node.ELEMENT_NODE:
node = node.nextSibling
return node
def get_nodes(self, path):
"""Returns a list of descendants matching given 'path'.
-
- Path must be a string in format 'child_name/grandchild_name/etc'.
No
+
+ Path must be a string in format 'child_name/grandchild_name/etc'.
No
slash is allowed at the beginning or end of the path string.
Returns an
- empty list if no matching descendants found and raises
AttributeError
+ empty list if no matching descendants found and raises
AttributeError
if path is invalid.
"""
if type(path) not in StringTypes or path == '' or path[0] == '/'
or path[-1] == '/':
@@ -49,10 +49,10 @@
for child in self.children:
matches += child._get_matching_elements(path.split('/'))
return matches
-
+
def get_node(self, path):
"""Similar as get_nodes but checks that exactly one node is found.
-
+
Node is returned as is (i.e. not in a list) and AttributeError
risen if
no match or more than one match found.
"""
@@ -62,10 +62,10 @@
if len(nodes) > 1:
raise AttributeError("Multiple nodes matching path '%s'
found" % path)
return nodes[0]
-
+
def get_attr(self, name, default=None):
"""Helper for getting node's attributes.
-
+
Otherwise equivalent to 'node.attrs.get(name, default)' but raises
an AttributeError if no value found and no default given.
"""
@@ -76,14 +76,14 @@
def __getattr__(self, name):
"""Syntactic sugar for get_nodes (e.g. dom.elem[0].subelem).
-
+
Differs from get_nodes so that if not matching nodes are found an
AttributeError is risen instead of returning an empty list."""
nodes = self.get_nodes(name)
if len(nodes) == 0:
raise AttributeError("No nodes matching path '%s' found" %
name)
return nodes
-
+
def __getitem__(self, name):
"""Syntactic sugar for get_node (e.g. dom['elem/subelem'])"""
try: