svn: r18617
This commit is contained in:
Paul Franklin 2011-12-17 21:04:50 +00:00
parent 97c45fe079
commit bcd7c38e4e
2 changed files with 15 additions and 14 deletions

View File

@ -276,7 +276,7 @@ def encodingdefs():
pass pass
if constfunc.win(): if constfunc.win():
# python encoding is ascii, but C functions need to recieve the # python encoding is ascii, but C functions need to receive the
# windows codeset, so convert over to it # windows codeset, so convert over to it
conv_utf8_tosrtkey = lambda x: locale.strxfrm(x.decode("utf-8").encode( conv_utf8_tosrtkey = lambda x: locale.strxfrm(x.decode("utf-8").encode(
codeset)) codeset))
@ -287,7 +287,7 @@ if constfunc.win():
codeset)) codeset))
conv_unicode_tosrtkey_ongtk = lambda x: locale.strxfrm(x.encode(codeset,'replace')) conv_unicode_tosrtkey_ongtk = lambda x: locale.strxfrm(x.encode(codeset,'replace'))
else: else:
# on unix C functions need to recieve utf-8. Default conversion would # on unix C functions need to receive utf-8. Default conversion would
# use ascii, so it is needed to be explicit about the resulting encoding # use ascii, so it is needed to be explicit about the resulting encoding
conv_utf8_tosrtkey = lambda x: locale.strxfrm(x) conv_utf8_tosrtkey = lambda x: locale.strxfrm(x)
conv_unicode_tosrtkey = lambda x: locale.strxfrm(x.encode("utf-8")) conv_unicode_tosrtkey = lambda x: locale.strxfrm(x.encode("utf-8"))
@ -343,7 +343,7 @@ def find_folder( filename):
except: except:
pass pass
# Build list of elternate encodings # Build list of alternate encodings
try: try:
encodings = [sys.getfilesystemencoding(), encodings = [sys.getfilesystemencoding(),
locale.getpreferredencoding(), locale.getpreferredencoding(),
@ -371,7 +371,7 @@ def get_unicode_path_from_file_chooser(path):
:rtype: unicode :rtype: unicode
:returns: The Unicode version of path. :returns: The Unicode version of path.
""" """
# make omly unicode of path of type 'str' # make only unicode of path of type 'str'
if not (isinstance(path, str)): if not (isinstance(path, str)):
return path return path
@ -398,12 +398,12 @@ def get_unicode_path_from_env_var(path):
:rtype: unicode :rtype: unicode
:returns: The Unicode version of path. :returns: The Unicode version of path.
""" """
# make omly unicode of path of type 'str' # make only unicode of path of type 'str'
if not (isinstance(path, str)): if not (isinstance(path, str)):
return path return path
if constfunc.win(): if constfunc.win():
# In Windows path/filename returned from a emvironment variable is in filesystemencoding # In Windows path/filename returned from a environment variable is in filesystemencoding
try: try:
new_path = unicode(path, sys.getfilesystemencoding()) new_path = unicode(path, sys.getfilesystemencoding())
return new_path return new_path
@ -890,7 +890,7 @@ def probably_alive(person, db,
""" """
Return true if the person may be alive on current_date. Return true if the person may be alive on current_date.
This works by a process of emlimination. If we can't find a good This works by a process of elimination. If we can't find a good
reason to believe that someone is dead then we assume they must reason to believe that someone is dead then we assume they must
be alive. be alive.
@ -952,7 +952,7 @@ def probably_alive_range(person, db,
def get_referents(handle, db, primary_objects): def get_referents(handle, db, primary_objects):
""" Find objects that refer to an object. """ Find objects that refer to an object.
This function is the base for other get_<object>_referents finctions. This function is the base for other get_<object>_referents functions.
""" """
# Use one pass through the reference map to grab all the references # Use one pass through the reference map to grab all the references

View File

@ -339,16 +339,17 @@ class ArgParser(object):
if len(options) > 0 and self.open is None and self.imports == [] \ if len(options) > 0 and self.open is None and self.imports == [] \
and not (self.list or self.list_more or self.help or self.runqml): and not (self.list or self.list_more or self.help or self.runqml):
# Extract and convert to unicode the arguments in the list. # Extract and convert to unicode the arguments in the list.
# The % operator replaces the list elements with repr() of the list elemements # The % operator replaces the list elements with repr() of
# which is OK for latin characters, but not for non latin characters in list elements # the list elements, which is OK for latin characters
# but not for non-latin characters in list elements
cliargs = "[ " cliargs = "[ "
for arg in range(len(self.args) - 1): for arg in range(len(self.args) - 1):
cliargs += Utils.get_unicode_path_from_env_var(self.args[arg + 1]) + " " cliargs += Utils.get_unicode_path_from_env_var(self.args[arg + 1]) + " "
cliargs += "]" cliargs += "]"
self.errors += [(_('Error parsing the arguments'), self.errors += [(_('Error parsing the arguments'),
_("Error parsing the arguments: %s \n" _("Error parsing the arguments: %s \n"
"To use in the command-line mode," \ "To use in the command-line mode, supply at "
"supply at least one input file to process.") % cliargs)] "least one input file to process.") % cliargs)]
if need_to_quit: if need_to_quit:
sys.exit(0) sys.exit(0)