Skip to content

Commit

Permalink
fix urllib.unquote
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyu committed Dec 20, 2016
1 parent 3018cb8 commit 6ac2e7b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions xadmin/plugins/themes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#coding:utf-8
from __future__ import print_function
import urllib, httplib2
import httplib2
from django.template import loader
from django.core.cache import cache
from django.utils import six
Expand All @@ -9,6 +9,11 @@
from xadmin.models import UserSettings
from xadmin.views import BaseAdminPlugin, BaseAdminView
from xadmin.util import static, json
import six
if six.PY2:
import urllib
else:
import urllib.parse

THEME_CACHE_KEY = 'xadmin_themes'

Expand All @@ -32,7 +37,11 @@ def _get_theme(self):
except Exception:
pass
if '_theme' in self.request.COOKIES:
return urllib.unquote(self.request.COOKIES['_theme'])
if six.PY2:
func = urllib.unquote
else:
func = urllib.parse.unquote
return func(self.request.COOKIES['_theme'])
return self.default_theme

def get_context(self, context):
Expand Down

0 comments on commit 6ac2e7b

Please sign in to comment.