FormRequest: fix unicode xpath exception

This commit is contained in:
Νικόλαος-Διγενής Καραγιάννης 2015-11-13 18:56:05 +02:00
parent 395ef805eb
commit 4f98be60be
1 changed files with 2 additions and 1 deletions

View File

@ -85,7 +85,8 @@ def _get_form(response, formname, formid, formnumber, formxpath):
el = el.getparent()
if el is None:
break
raise ValueError('No <form> element found with %s' % formxpath)
encoded = formxpath if six.PY3 else formxpath.encode('unicode_escape')
raise ValueError('No <form> element found with %s' % encoded)
# If we get here, it means that either formname was None
# or invalid