[Docstring-checkins] CVS: dps/dps utils.py,1.14,1.15 nodes.py,1.28,1.29
Status: Pre-Alpha
Brought to you by:
goodger
From: David G. <go...@us...> - 2002-02-15 22:42:49
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv26164 Modified Files: utils.py nodes.py Log Message: - Changed "system_warning" to "system_message". Index: utils.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/utils.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** utils.py 12 Feb 2002 02:16:27 -0000 1.14 --- utils.py 15 Feb 2002 22:42:44 -0000 1.15 *************** *** 15,22 **** ! class SystemWarning(Exception): ! def __init__(self, system_warning): ! Exception.__init__(self, system_warning.astext()) --- 15,22 ---- ! class SystemMessage(Exception): ! def __init__(self, system_message): ! Exception.__init__(self, system_message.astext()) *************** *** 24,36 **** """ ! Info/warning/error reporter and ``system_warning`` element generator. ! Five levels of system warnings are defined, along with corresponding methods: `debug()`, `info()`, `warning()`, `error()`, and `severe()`. There is typically one Reporter object per process. A Reporter object is instantiated with thresholds for generating warnings and errors (raising ! exceptions), a switch to turn debug output on or off, and a I/O stream for ! warnings. These are stored in the default reporting category, ''. Multiple reporting categories [#]_ may be set, each with its own warning --- 24,37 ---- """ ! Info/warning/error reporter and ``system_message`` element generator. ! Five levels of system messages are defined, along with corresponding methods: `debug()`, `info()`, `warning()`, `error()`, and `severe()`. There is typically one Reporter object per process. A Reporter object is instantiated with thresholds for generating warnings and errors (raising ! exceptions), a switch to turn debug output on or off, and an I/O stream ! for warnings. These are stored in the default reporting category, '' ! (zero-length string). Multiple reporting categories [#]_ may be set, each with its own warning *************** *** 41,49 **** closest ancestor category that has been set. ! When a system warning is generated, the stored values from its category ! (or ancestor if unset) are retrieved. The system warning level is compared to the thresholds stored in the category, and a warning or error is ! generated as appropriate. Debug warnings are produced iff the stored debug ! switch is on. Warning output is sent to the stored warning stream. .. [#]_ The concept of "categories" was inspired by the log4j project: --- 42,50 ---- closest ancestor category that has been set. ! When a system message is generated, the stored values from its category ! (or ancestor if unset) are retrieved. The system message level is compared to the thresholds stored in the category, and a warning or error is ! generated as appropriate. Debug messages are produced iff the stored debug ! switch is on. Message output is sent to the stored warning stream. .. [#]_ The concept of "categories" was inspired by the log4j project: *************** *** 52,56 **** levels = 'DEBUG INFO WARNING ERROR SEVERE'.split() ! """List of names for system warning levels, indexed by level.""" def __init__(self, warninglevel, errorlevel, warningstream=None, debug=0): --- 53,57 ---- levels = 'DEBUG INFO WARNING ERROR SEVERE'.split() ! """List of names for system message levels, indexed by level.""" def __init__(self, warninglevel, errorlevel, warningstream=None, debug=0): *************** *** 62,68 **** - `warninglevel`: The level at or above which warning output will be sent to `warningstream`. ! - `errorlevel`: The level at or above which `SystemWarning` exceptions will be raised. ! - `debug`: Show debug (level=0) system warnings? - `warningstream`: Where warning output is sent (`None` implies `sys.stderr`). --- 63,69 ---- - `warninglevel`: The level at or above which warning output will be sent to `warningstream`. ! - `errorlevel`: The level at or above which `SystemMessage` exceptions will be raised. ! - `debug`: Show debug (level=0) system messages? - `warningstream`: Where warning output is sent (`None` implies `sys.stderr`). *************** *** 91,101 **** return self.categories[category] ! def system_warning(self, level, comment=None, children=[], category=''): """ ! Return a system_warning object. Raise an exception or generate a warning if appropriate. """ ! sw = nodes.system_warning(comment, level=level, type=self.levels[level], *children) debug, warninglevel, errorlevel, stream = self.getcategory(category) --- 92,102 ---- return self.categories[category] ! def system_message(self, level, comment=None, children=[], category=''): """ ! Return a system_message object. Raise an exception or generate a warning if appropriate. """ ! sw = nodes.system_message(comment, level=level, type=self.levels[level], *children) debug, warninglevel, errorlevel, stream = self.getcategory(category) *************** *** 106,110 **** print >>stream, 'Reporter:', sw.astext() if level >= errorlevel: ! raise SystemWarning(sw) return sw --- 107,111 ---- print >>stream, 'Reporter:', sw.astext() if level >= errorlevel: ! raise SystemMessage(sw) return sw *************** *** 112,126 **** """ Level-0, "DEBUG": an internal reporting issue. Typically, there is no ! effect on the processing. Level-0 system warnings are handled separately from the others. """ ! return self.system_warning(0, comment, children, category) def info(self, comment=None, children=[], category=''): """ Level-1, "INFO": a minor issue that can be ignored. Typically there is ! no effect on processing, and level-1 system warnings are not reported. """ ! return self.system_warning(1, comment, children, category) def warning(self, comment=None, children=[], category=''): --- 113,127 ---- """ Level-0, "DEBUG": an internal reporting issue. Typically, there is no ! effect on the processing. Level-0 system messages are handled separately from the others. """ ! return self.system_message(0, comment, children, category) def info(self, comment=None, children=[], category=''): """ Level-1, "INFO": a minor issue that can be ignored. Typically there is ! no effect on processing, and level-1 system messages are not reported. """ ! return self.system_message(1, comment, children, category) def warning(self, comment=None, children=[], category=''): *************** *** 129,133 **** there may be unpredictable problems with the output. """ ! return self.system_warning(2, comment, children, category) def error(self, comment=None, children=[], category=''): --- 130,134 ---- there may be unpredictable problems with the output. """ ! return self.system_message(2, comment, children, category) def error(self, comment=None, children=[], category=''): *************** *** 136,140 **** output will contain errors. """ ! return self.system_warning(3, comment, children, category) def severe(self, comment=None, children=[], category=''): --- 137,141 ---- output will contain errors. """ ! return self.system_message(3, comment, children, category) def severe(self, comment=None, children=[], category=''): *************** *** 142,148 **** Level-4, "SEVERE": a severe error that must be addressed. If ignored, the output will contain severe errors. Typically level-4 system ! warnings are turned into exceptions which halt processing. """ ! return self.system_warning(4, comment, children, category) --- 143,149 ---- Level-4, "SEVERE": a severe error that must be addressed. If ignored, the output will contain severe errors. Typically level-4 system ! messages are turned into exceptions which halt processing. """ ! return self.system_message(4, comment, children, category) Index: nodes.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/nodes.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** nodes.py 13 Feb 2002 02:26:54 -0000 1.28 --- nodes.py 15 Feb 2002 22:42:44 -0000 1.29 *************** *** 465,469 **** self.reporter = reporter ! """System warning generator.""" self.languagecode = languagecode --- 465,469 ---- self.reporter = reporter ! """System message generator.""" self.languagecode = languagecode *************** *** 546,550 **** and t['refuri'] == refuri: level = 1 # just inform if refuri's identical ! sw = self.reporter.system_warning( level, 'Duplicate explicit target name: "%s"' % name) innode += sw --- 546,550 ---- and t['refuri'] == refuri: level = 1 # just inform if refuri's identical ! sw = self.reporter.system_message( level, 'Duplicate explicit target name: "%s"' % name) innode += sw *************** *** 703,707 **** ! class system_warning(Special, PreBibliographic, Element): def __init__(self, comment=None, *children, **attributes): --- 703,707 ---- ! class system_message(Special, PreBibliographic, Element): def __init__(self, comment=None, *children, **attributes): *************** *** 753,757 **** reference revision row section short_option status strong substitution_definition ! substitution_reference subtitle system_warning table target tbody term tgroup thead tip title transition version vms_option --- 753,757 ---- reference revision row section short_option status strong substitution_definition ! substitution_reference subtitle system_message table target tbody term tgroup thead tip title transition version vms_option |