188,10 → 188,12 |
if search_text: |
#xpath = xpath + '//text()' |
needles = [] |
if type(search_text) == str: |
if type(search_text) == list: |
needles = search_text |
else: |
# FIXME: No longer needed |
assert type(search_text) == str or type(search_text) == unicode |
needles = [ search_text, ] |
else: |
needles = search_text |
selector = '' |
for search in needles: |
if ignore_case: |
249,8 → 251,7 |
s += 'Notes: %s\n' % notes |
for field in fields: |
s += '%s %s\n' % field # field, value |
#s += '\n' |
print s |
print s.encode(sys.stdout.encoding) |
|
def dump_result(res, query_desc, dumpfn=dump_single_result): |
''' Print query results. |
422,6 → 423,9 |
# Decompress actual data (15 is wbits [ref3] DON'T CHANGE, 2**15 is the (initial) buf size) |
padlen = ord(cleardata_gz[-1]) |
try: |
# Note data is encoded in UTF-8 but not decoded yet (because |
# the XML parser is too easy to choke in that case) |
# http://lxml.de/parsing.html#python-unicode-strings |
return zlib.decompress(cleardata_gz[:-padlen], 15, 2**15) |
except zlib.error: |
raise DecompressError |