~ubuntu-branches/ubuntu/quantal/python-docutils/quantal

« back to all changes in this revision

Viewing changes to debian/patches/languages-get_language-2nd-arg-optional.diff

  • Committer: Package Import Robot
  • Author(s): Jakub Wilk
  • Date: 2011-09-16 20:53:45 UTC
  • Revision ID: package-import@ubuntu.com-20110916205345-p0brv4kliyjz8ymf
* Remove needless comments from debian/rules.
* Restore historical behavior of languages.get_language() taking only a
  single argument (languages-get_language-2nd-arg-optional.diff). Thanks to
  Sergio Talens-Oliag for the bug report.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Restore historical behavior of languages.get_language() taking only a single argument.
 
2
 In Docutils 0.8, a second argument was added to languages.get_language(). This
 
3
 patch makes the function accept also only a single argument in order to
 
4
 restore its historical behavior.
 
5
Author: Jakub Wilk <jwilk@debian.org>
 
6
Bug: http://sourceforge.net/tracker/?group_id=38414&atid=422030
 
7
Bug-Debian: http://bugs.debian.org/641562
 
8
Last-Update: 2011-09-16
 
9
 
 
10
--- a/docutils/languages/__init__.py
 
11
+++ b/docutils/languages/__init__.py
 
12
@@ -15,7 +15,7 @@
 
13
 
 
14
 _languages = {}
 
15
 
 
16
-def get_language(language_code, reporter):
 
17
+def get_language(language_code, reporter=None):
 
18
     """Return module with language localizations.
 
19
 
 
20
     `language_code` is a "BCP 47" language tag.
 
21
@@ -31,9 +31,10 @@
 
22
             continue
 
23
         _languages[tag] = module
 
24
         return module
 
25
-    reporter.warning(
 
26
-        'language "%s" not supported: ' % language_code +
 
27
-        'Docutils-generated text will be in English.')
 
28
+    if reporter is not None:
 
29
+        reporter.warning(
 
30
+            'language "%s" not supported: ' % language_code +
 
31
+            'Docutils-generated text will be in English.')
 
32
     module = __import__('en', globals(), locals())
 
33
     _languages[tag] = module # warn only one time!
 
34
     return module