Skip to content

Commit

Permalink
Fixed saving a show with unicode scene name exceptions, like Naruto S…
Browse files Browse the repository at this point in the history
…hippuuden. The error only occurs on Windows. I'm explicitly saving scene_exceptions as unicode to the exception list and db.
  • Loading branch information
p0psicles committed May 11, 2016
1 parent cd52111 commit 3133d5f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions gui/slick/views/displayShow.mako
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@
% else:
<tr><td class="showLegend"><span style="color: red;">Location: </span></td><td><span style="color: red;">${showLoc[0]}</span> (Missing)</td></tr>
% endif
% if show.exceptions:
<tr><td class="showLegend" style="vertical-align: top;">Scene Name:</td><td>${(show.name, " | ".join(show.exceptions))[show.exceptions != 0]}</td></tr>
% if all_scene_exceptions:
<tr><td class="showLegend" style="vertical-align: top;">Scene Name:</td><td>${all_scene_exceptions}</td></tr>
% endif
% if require_words:
Expand Down Expand Up @@ -582,4 +582,4 @@
<!--End - Bootstrap Modal-->
</%block>
</%block>
4 changes: 2 additions & 2 deletions sickbeard/scene_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ def update_scene_exceptions(indexer_id, scene_exceptions, season=-1):
# A change has been made to the scene exception list. Let's clear the cache, to make this visible
if indexer_id in exceptionsCache:
exceptionsCache[indexer_id] = {}
exceptionsCache[indexer_id][season] = scene_exceptions
exceptionsCache[indexer_id][season] = [se.decode('utf-8', 'ignore') for se in scene_exceptions]

for cur_exception in scene_exceptions:
for cur_exception in [se.decode('utf-8', 'ignore') for se in scene_exceptions]:
cache_db_con.action("INSERT INTO scene_exceptions (indexer_id, show_name, season) VALUES (?,?,?)",
[indexer_id, cur_exception, season])

Expand Down
6 changes: 5 additions & 1 deletion sickbeard/webserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ def render(self, *args, **kwargs):
kwargs['title'] = '500'
kwargs['header'] = 'Mako Error'
kwargs['backtrace'] = RichTraceback()
for (filename, lineno, function, line) in kwargs['backtrace'].traceback:
print("File %s, line %s, in %s" % (filename, lineno, function))
print(line, "\n")
print("%s: %s" % (str(kwargs['backtrace'].error.__class__.__name__), kwargs['backtrace'].error))
return get_lookup().get_template('500.mako').render_unicode(*args, **kwargs)


Expand Down Expand Up @@ -1393,7 +1397,7 @@ def titler(x):
submenu=submenu, showLoc=showLoc, show_message=show_message,
show=showObj, sql_results=sql_results, seasonResults=seasonResults,
sortedShowLists=sortedShowLists, bwl=bwl, epCounts=epCounts,
epCats=epCats, all_scene_exceptions=showObj.exceptions,
epCats=epCats, all_scene_exceptions=' | '.join(showObj.exceptions),
scene_numbering=get_scene_numbering_for_show(indexerid, indexer),
xem_numbering=get_xem_numbering_for_show(indexerid, indexer),
scene_absolute_numbering=get_scene_absolute_numbering_for_show(indexerid, indexer),
Expand Down

0 comments on commit 3133d5f

Please sign in to comment.