Skip to content

Commit

Permalink
Revert the encoding changes for now while fixing the bug that was aff…
Browse files Browse the repository at this point in the history
…ecting the database migration.
  • Loading branch information
midgetspy committed Jul 18, 2012
1 parent f913c47 commit 1656f23
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 73 deletions.
23 changes: 12 additions & 11 deletions sickbeard/encodingKludge.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.

import os, traceback
import os

from sickbeard import logger
import sickbeard
Expand Down Expand Up @@ -48,15 +48,16 @@ def fixListEncodings(x):


def ek(func, *args):
result = None

def changeByteStringToUnicode(obj):
if type(obj) == str:
logger.log(u"A bytestring was used as an argument for function "+func.__name__+": "+repr(obj), logger.WARNING)
logger.log(''.join(traceback.format_stack()), logger.DEBUG)
return obj.decode(sickbeard.SYS_ENCODING)
else:
return obj

args = map(changeByteStringToUnicode, args)
if os.name == 'nt':
result = func(*args)
else:
result = func(*[x.encode(sickbeard.SYS_ENCODING) if type(x) in (str, unicode) else x for x in args])

return func(*args)
if type(result) == in (list, tuple):
return fixListEncodings(result)
elif type(result) == str:
return fixStupidEncodings(result)
else:
return result
62 changes: 0 additions & 62 deletions tests/encodingTests.py

This file was deleted.

0 comments on commit 1656f23

Please sign in to comment.