~mterry/duplicity/unicode-future

« back to all changes in this revision

Viewing changes to duplicity/selection.py

  • Committer: Aaron A Whitehouse
  • Date: 2017-06-13 20:39:51 UTC
  • Revision ID: lists@whitehouse.kiwi.nz-20170613203951-9tyi2i2v6auuvijg
* Remove util.bytes_to_uc (as either .decode or fsdecode is preferable).
* Move unicode conversion for select options from selection.py to commandline.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
246
246
        filelists_index = 0
247
247
        try:
248
248
            for opt, arg in argtuples:
249
 
                # assert isinstance(opt, unicode), u"option " + util.bytes_to_uc(opt) + u" is not unicode"
250
 
                # assert isinstance(arg, unicode), u"option " + util.bytes_to_uc(arg) + u" is not unicode"
 
249
                assert isinstance(opt, unicode), u"option " + opt.decode(sys.getfilesystemencoding(), "ignore") + \
 
250
                                                 u" is not unicode"
 
251
                assert isinstance(arg, unicode), u"option " + arg.decode(sys.getfilesystemencoding(), "ignore") + \
 
252
                                                 u" is not unicode"
251
253
                # ToDo: replace the next three lines once we can make commandline return unicode
252
 
                opt = opt.decode(sys.getfilesystemencoding(), "strict")
253
 
                if not isinstance(arg, unicode):
254
 
                    # ToDo: use sys.getfilesystemencoding() once figure out why this is not working.
255
 
                    arg = arg.decode("UTF-8", "strict")  # ToDo: Change from "strict" once found problems
 
254
                # opt = opt.decode(sys.getfilesystemencoding(), "strict")
 
255
                # if not isinstance(arg, unicode):
 
256
                #     # ToDo: use sys.getfilesystemencoding() once figure out why this is not working.
 
257
                #     arg = arg.decode("UTF-8", "strict")  # ToDo: Change from "strict" once found problems
256
258
 
257
259
                if opt == u"--exclude":
258
260
                    self.add_selection_func(self.glob_get_sf(arg, 0))