http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11651
Revision: 11651
Author: valhallasw
Date: 2013-06-15 13:24:58 +0000 (Sat, 15 Jun 2013)
Log Message:
-----------
Add exceptions for commons and wikidata - language should not be asked for at single language wikis
Modified Paths:
--------------
branches/rewrite/generate_user_files.py
Modified: branches/rewrite/generate_user_files.py
===================================================================
--- branches/rewrite/generate_user_files.py 2013-06-13 09:22:26 UTC (rev 11650)
+++ branches/rewrite/generate_user_files.py 2013-06-15 13:24:58 UTC (rev 11651)
@@ -11,6 +11,8 @@
import codecs, os, re, sys
import platform
+single_wiki_families = ['commons', 'wikidata']
+
def get_base_dir():
"""Return the directory in which user-specific information is stored.
@@ -143,8 +145,11 @@
fam = listchoice(known_families,
"Select family of sites we are working on",
default='wikipedia')
- mylang = raw_input(
+ if fam not in single_wiki_families:
+ mylang = raw_input(
"The language code of the site we're working on (default: 'en'): ") or 'en'
+ else:
+ mylang = fam
username = raw_input("Username (%s %s): "
% (mylang, fam))
username = unicode(username, console_encoding)
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11648
Revision: 11648
Author: valhallasw
Date: 2013-06-13 06:56:50 +0000 (Thu, 13 Jun 2013)
Log Message:
-----------
Update to r11646: the edits to config2.py were not included, preventing the new
windows user interface from working.
Modified Paths:
--------------
branches/rewrite/pywikibot/config2.py
Modified: branches/rewrite/pywikibot/config2.py
===================================================================
--- branches/rewrite/pywikibot/config2.py 2013-06-13 01:02:12 UTC (rev 11647)
+++ branches/rewrite/pywikibot/config2.py 2013-06-13 06:56:50 UTC (rev 11648)
@@ -169,6 +169,19 @@
#we get "StdioOnnaStick instance has no attribute 'encoding'"
console_encoding = None
+# The encoding the user would like to see text transliterated to. This can be
+# set to a charset (e.g. 'ascii', 'iso-8859-1' or 'cp850'), and we will output
+# only characters that exist in that charset. However, the characters will be
+# output using console_encoding.
+# If this is not defined on Windows, we emit a Warning explaining the user
+# to either switch to a Unicode-able font and use
+# transliteration_target = None
+# or to keep using raster fonts and set
+# transliteration_target = console_encoding
+# After emitting the warning, this last option will be set.
+
+transliteration_target = 'not set'
+
# The encoding in which textfiles are stored, which contain lists of page
# titles. The most used is: 'utf-8'. 'utf-8-sig' recognizes BOM but it is
# available on Python 2.5 or higher. For a complete list please see:
@@ -662,12 +675,23 @@
" Misspelled?" % locals()
# Fix up default console_encoding
-if console_encoding == None:
+if console_encoding is None:
if __sys.platform == 'win32':
console_encoding = 'cp850'
else:
console_encoding = 'iso-8859-1'
+# Fix up transliteration_target
+if transliteration_target == 'not set':
+ if __sys.platform == 'win32':
+ transliteration_target = console_encoding
+ print "WARNING: Running on Windows and transliteration_target is not set."
+ print "Please see http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Windows"
+ else:
+ transliteration_target = None
+elif transliteration_target in ('None', 'none'):
+ transliteration_target = None
+
# Save base_dir for use by other modules
base_dir = _base_dir