Skip to content

Commit

Permalink
Merge pull request #5461 from nsoranzo/python3
Browse files Browse the repository at this point in the history
Python3: make encoded id JSON-serializable
  • Loading branch information
jmchilton committed Feb 7, 2018
2 parents 3a7414a + b3ea839 commit 43d5725
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/galaxy/web/security/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def encode_id(self, obj_id, kind=None):
# Pad to a multiple of 8 with leading "!"
s = (b"!" * (8 - len(s) % 8)) + s
# Encrypt
return codecs.encode(id_cipher.encrypt(s), 'hex')
return unicodify(codecs.encode(id_cipher.encrypt(s), 'hex'))

def encode_dict_ids(self, a_dict, kind=None, skip_startswith=None):
"""
Expand Down
7 changes: 6 additions & 1 deletion test/functional/twilltestcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from twill.other_packages._mechanize_dist import ClientForm

from base.testcase import FunctionalTestCase # noqa: I100,I202
from galaxy.util import unicodify # noqa: I201

# Force twill to log to a buffer -- FIXME: Should this go to stdout and be captured by nose?
buffer = StringIO()
Expand Down Expand Up @@ -65,7 +66,7 @@ def check_page(self, strings_displayed, strings_displayed_count, strings_not_dis

def check_page_for_string(self, patt):
"""Looks for 'patt' in the current browser page"""
page = self.last_page()
page = unicodify(self.last_page())
if page.find(patt) == -1:
fname = self.write_temp_file(page)
errmsg = "no match to '%s'\npage content written to '%s'\npage: [[%s]]" % (patt, fname, page)
Expand Down Expand Up @@ -205,6 +206,10 @@ def json_from_url(self, url, params={}):
return loads(self.last_page())

def last_page(self):
"""
Return the last visited page (usually HTML, but can binary data as
well).
"""
return tc.browser.get_html()

def last_url(self):
Expand Down

0 comments on commit 43d5725

Please sign in to comment.