[Epydoc-commits] SF.net SVN: epydoc:[1811] trunk/epydoc/src/epydoc/apidoc.py
Brought to you by:
edloper
From: <ed...@us...> - 2009-02-03 21:29:59
|
Revision: 1811 http://epydoc.svn.sourceforge.net/epydoc/?rev=1811&view=rev Author: edloper Date: 2009-02-03 21:29:51 +0000 (Tue, 03 Feb 2009) Log Message: ----------- added not_found_exception parameter for find method Modified Paths: -------------- trunk/epydoc/src/epydoc/apidoc.py Modified: trunk/epydoc/src/epydoc/apidoc.py =================================================================== --- trunk/epydoc/src/epydoc/apidoc.py 2008-03-31 03:22:51 UTC (rev 1810) +++ trunk/epydoc/src/epydoc/apidoc.py 2009-02-03 21:29:51 UTC (rev 1811) @@ -1859,7 +1859,7 @@ return None, None - def find(self, name, context): + def find(self, name, context, not_found_exception=False): """ Look for an C{APIDoc} named C{name}, relative to C{context}. Return the C{APIDoc} if one is found; otherwise, return @@ -1874,12 +1874,17 @@ @type name: C{str} or L{DottedName} @type context: L{APIDoc} + + @param not_found_exception: If true, then raise an exception + if the name is not found anywhere (including builtins, + function parameters, etc.) """ if isinstance(name, basestring): name = re.sub(r'\(.*\)$', '', name.strip()) if re.match('^([a-zA-Z_]\w*)(\.[a-zA-Z_]\w*)*$', name): name = DottedName(name) else: + if not_found_exception: raise ValueError(name) return None elif not isinstance(name, DottedName): raise TypeError("'name' should be a string or DottedName") @@ -1931,6 +1936,9 @@ # Drop this item so that the warning is reported only once. # fail() will fail anyway. del self.mlclasses[name[-1]] + else: + if not_found_exception: raise ValueError(name) + return None def _get_module_classes(self, docs): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |