[Python-checkins] python/nondist/peps/docutils/parsers/rst/directives __init__.py,1.1,1.2

goodger@users.sourceforge.net goodger@users.sourceforge.net
Sat, 16 Nov 2002 16:09:21 -0800


Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst/directives
In directory usw-pr-cvs1:/tmp/cvs-serv25859/parsers/rst/directives

Modified Files:
	__init__.py 
Log Message:
updated from Docutils

Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/docutils/parsers/rst/directives/__init__.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** __init__.py	8 Nov 2002 23:47:52 -0000	1.1
--- __init__.py	17 Nov 2002 00:09:19 -0000	1.2
***************
*** 123,149 ****
      """
      Locate and return a directive function from its language-dependent name.
!     If not found in the current language, check English.
      """
      normname = directive_name.lower()
      messages = []
      if _directives.has_key(normname):
          return _directives[normname], messages
      try:
          canonicalname = language_module.directives[normname]
!     except (KeyError, AttributeError):
!         msg_text = ('No directive entry for "%s" in module "%s".'
!                     % (directive_name, language_module.__name__))
          try:
              canonicalname = _fallback_language_module.directives[normname]
!             msg_text += ('\nUsing English fallback for directive "%s".'
!                          % directive_name)
          except KeyError:
!             msg_text += ('\nTrying "%s" as canonical directive name.'
!                          % directive_name)
              # The canonical name should be an English name, but just in case:
              canonicalname = normname
!         warning = document.reporter.warning(
!             msg_text, line=document.current_line)
!         messages.append(warning)
      try:
          modulename, functionname = _directive_registry[canonicalname]
--- 123,157 ----
      """
      Locate and return a directive function from its language-dependent name.
!     If not found in the current language, check English.  Return None if the
!     named directive cannot be found.
      """
      normname = directive_name.lower()
      messages = []
+     msg_text = []
      if _directives.has_key(normname):
          return _directives[normname], messages
+     canonicalname = None
      try:
          canonicalname = language_module.directives[normname]
!     except AttributeError, error:
!         msg_text.append('Problem retrieving directive entry from language '
!                         'module %r: %s.' % (language_module, error))
!     except KeyError:
!         msg_text.append('No directive entry for "%s" in module "%s".'
!                         % (directive_name, language_module.__name__))
!     if not canonicalname:
          try:
              canonicalname = _fallback_language_module.directives[normname]
!             msg_text.append('Using English fallback for directive "%s".'
!                             % directive_name)
          except KeyError:
!             msg_text.append('Trying "%s" as canonical directive name.'
!                             % directive_name)
              # The canonical name should be an English name, but just in case:
              canonicalname = normname
!     if msg_text:
!         message = document.reporter.info(
!             '\n'.join(msg_text), line=document.current_line)
!         messages.append(message)
      try:
          modulename, functionname = _directive_registry[canonicalname]