r9914 pywikipedia - Code Review archive

Repository:pywikipedia
Revision:r9913‎ | r9914 | r9915 >
Date:09:32, 20 February 2012
Author:binbot
Status:ok
Tags:
Comment:
Enable calling main() of arbitrary module from within another script.
Solution proposed by Merlijn, http://thread.gmane.org/gmane.comp.python.pywikipediabot.general/12420/focus=12442
Modified paths:
  • /trunk/pywikipedia/wikipedia.py (modified) (history)

Diff [purge]

Index: trunk/pywikipedia/wikipedia.py
@@ -7688,6 +7688,10 @@
76897689 return os.path.basename(called)
76907690
76917691 def _decodeArg(arg):
 7692+ # We may pass a Unicode string to a script upon importing and calling
 7693+ # main() from another script.
 7694+ if isinstance(arg,unicode):
 7695+ return arg
76927696 if sys.platform == 'win32':
76937697 if config.console_encoding in ('cp437', 'cp850'):
76947698 # Western Windows versions give parameters encoded as windows-1252

Status & tagging log