Project

General

Profile

« Previous | Next » 

Revision 5144

tnrs.py: gwt_encode(): Escape special characters in the string instead of removing them, so that TNRS receives the original name rather than a modified version. This will help make the submitted names match up with the returned Name_submitted.

View differences:

lib/tnrs.py
8 8
import exc
9 9
import profiling
10 10
import streams
11
import strings
11 12

  
12 13
# Config
13 14
initial_pause = 0.35 # sec
......
55 56

  
56 57
class InvalidResponse(Exception): pass
57 58

  
58
def gwt_encode(str_): return re.sub(r'[^\w.() -]+', r' ', str_)
59
def gwt_encode(str_):
60
    return strings.esc_quotes(strings.json_encode(str_), '|', quote_esc='\!')
59 61

  
60 62
def parse_response(name, pattern, str_, response, response_info):
61 63
    match = re.match(pattern, str_)

Also available in: Unified diff