version 1.19, 2007/12/14 21:30:55
|
version 1.20, 2008/01/09 14:23:26
|
Line 19 except:
|
Line 19 except:
|
|
|
fm_ns = 'http://www.filemaker.com/fmpxmlresult' |
fm_ns = 'http://www.filemaker.com/fmpxmlresult' |
|
|
version_string = "V0.5 ROC 11.12.2007" |
version_string = "V0.5.1 ROC 9.1.2008" |
|
|
|
def unicodify(str, withNone=False): |
|
"""decode str (utf-8 or latin-1 representation) into unicode object""" |
|
if withNone and str is None: |
|
return None |
|
if not str: |
|
return u"" |
|
if type(str) is StringType: |
|
try: |
|
return str.decode('utf-8') |
|
except: |
|
return str.decode('latin-1') |
|
else: |
|
return str |
|
|
|
def utf8ify(str, withNone=False): |
|
"""encode unicode object or string into byte string in utf-8 representation""" |
|
if withNone and str is None: |
|
return None |
|
if not str: |
|
return "" |
|
if type(str) is StringType: |
|
return str |
|
else: |
|
return str.encode('utf-8') |
|
|
def getTextFromNode(nodename): |
def getTextFromNode(nodename): |
"""get the cdata content of a node""" |
"""get the cdata content of a node""" |
Line 45 def SimpleSearch(curs,query, args=None,
|
Line 70 def SimpleSearch(curs,query, args=None,
|
#logger.debug("executing: "+query) |
#logger.debug("executing: "+query) |
if ascii: |
if ascii: |
# encode all in UTF-8 |
# encode all in UTF-8 |
query = query.encode("UTF-8") |
query = utf8ify(query) |
if args is not None: |
if args is not None: |
encargs = [] |
encargs = [] |
for a in args: |
for a in args: |
if a is not None and isinstance(a, str): |
encargs.append(utf8ify(a, withNone=True)) |
a = a.encode("UTF-8") |
|
encargs.append(a) |
|
|
|
args = encargs |
args = encargs |
|
|