Update of /cvsroot/happydoc/HappyDoc3/happydoclib
In directory sc8-pr-cvs1:/tmp/cvs-serv8618/happydoclib
Modified Files:
scanner.py
Log Message:
Let a PackageTree node know how to find its children by their mimetype.
Index: scanner.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/scanner.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** scanner.py 28 Dec 2002 16:41:16 -0000 1.12
--- scanner.py 29 Dec 2002 17:30:58 -0000 1.13
***************
*** 498,501 ****
--- 498,518 ----
return new_node
+ def getSubNodes(self, mimetype=None):
+ """Returns the children of this node.
+
+ If mimetype is not none, returns only the children with that
+ mimetype.
+ """
+ if mimetype is None:
+ return self.values()
+ else:
+ if not hasattr(self, 'grouped_children'):
+ self.grouped_children = {}
+ for node in self.values():
+ mimetype, encoding = node.getMimeType()
+ group = self.grouped_children.setdefault(mimetype, [])
+ group.append(node)
+ return self.grouped_children.get(mimetype, [])
+
def walk(self, callback):
"""Walk the PackageTree, calling the callback at each node.
|