Diff for /ZSQLExtend/importFMPXML.py between versions 1.18 and 1.22

version 1.18, 2007/12/11 20:30:40 version 1.22, 2008/02/04 19:06:34
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.2 ROC 4.2.2008"
   
   def unicodify(text, withNone=False):
       """decode str (utf-8 or latin-1 representation) into unicode object"""
       if withNone and text is None:
           return None
       if not text:
           return u""
       if isinstance(text, str):
           try:
               return text.decode('utf-8')
           except:
               return text.decode('latin-1')
       else:
           return text
   
   def utf8ify(text, withNone=False):
       """encode unicode object or string into byte string in utf-8 representation"""
       if withNone and text is None:
           return None
       if not text:
           return ""
       if isinstance(text, unicode):
           return text.encode('utf-8')
       else:
           return text
   
 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
   
Line 412  class xml_handler: Line 435  class xml_handler:
         args = []          args = []
         for fn in self.xml_update_list:          for fn in self.xml_update_list:
             # do not update id_field              # do not update id_field
             if self.id_field and fn == self.xml_id:              if update and fn == self.xml_id:
                 continue                  continue
                           
             f = self.xml_field_map[fn]              f = self.xml_field_map[fn]

Removed from v.1.18  
changed lines
  Added in v.1.22


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>