version 1.128, 2008/08/07 14:04:31
|
version 1.132, 2009/11/17 18:21:28
|
Line 388 class ZSQLExtendFolder(Folder,Persistent
|
Line 388 class ZSQLExtendFolder(Folder,Persistent
|
|
|
tfilehd,filename=tempfile.mkstemp() |
tfilehd,filename=tempfile.mkstemp() |
tfile=os.fdopen(tfilehd,'w') |
tfile=os.fdopen(tfilehd,'w') |
logging.info("import %s"%uploadfile) |
logging.info("importXMLFileFMP: importing %s"%uploadfile) |
for c in uploadfile.read(): |
for c in uploadfile.read(): |
tfile.write(c) |
tfile.write(c) |
tfile.close() |
tfile.close() |
Line 398 class ZSQLExtendFolder(Folder,Persistent
|
Line 398 class ZSQLExtendFolder(Folder,Persistent
|
if not dsn: |
if not dsn: |
dsn=self.getConnectionObj().connection_string |
dsn=self.getConnectionObj().connection_string |
|
|
|
logging.debug("dsn: %s"%dsn) |
|
logging.debug("table: %s"%table) |
|
logging.debug("update_fields: %s"%update_fields) |
|
logging.debug("id_field: %s"%id_field) |
|
logging.debug("sync_mode: %s"%sync_mode) |
|
logging.debug("lc_names: %s"%lc_names) |
|
logging.debug("keep_fields: %s"%keep_fields) |
|
logging.debug("ascii_db: %s"%ascii_db) |
|
logging.debug("replace: %s"%replace) |
|
logging.debug("backup: %s"%backup) |
|
logging.debug("debug: %s"%debug) |
|
logging.debug("log_to_response: %s"%log_to_response) |
|
logging.debug("RESPONSE: %s"%repr(RESPONSE)) |
|
|
tablelist=table.split(',') |
tablelist=table.split(',') |
logging.debug("tablelist: %s" %tablelist) |
logging.debug("tablelist: %s" %tablelist) |
#table=tables |
#table=tables |
Line 421 class ZSQLExtendFolder(Folder,Persistent
|
Line 435 class ZSQLExtendFolder(Folder,Persistent
|
|
|
if RESPONSE and log_to_response: |
if RESPONSE and log_to_response: |
# set up logging to response as plain text |
# set up logging to response as plain text |
|
logging.debug("Setting up logging to RESPONSE") |
RESPONSE.setHeader("Content-Type","text/plain; charset=utf-8") |
RESPONSE.setHeader("Content-Type","text/plain; charset=utf-8") |
RESPONSE.write("Import FMPXML file...\n\n") |
RESPONSE.write("Import FMPXML file...\n\n") |
|
RESPONSE.flush() |
loghandler = logging.StreamHandler(RESPONSE) |
loghandler = logging.StreamHandler(RESPONSE) |
if debug: |
if debug: |
loghandler.setLevel(logging.DEBUG) |
loghandler.setLevel(logging.DEBUG) |
Line 433 class ZSQLExtendFolder(Folder,Persistent
|
Line 449 class ZSQLExtendFolder(Folder,Persistent
|
options.use_logger_instance = logger |
options.use_logger_instance = logger |
|
|
importFMPXML(options) |
importFMPXML(options) |
|
logging.info("importXMLFileFMP: done") |
|
|
|
|
if RESPONSE and log_to_response: |
if RESPONSE and log_to_response: |
loghandler.flush() |
loghandler.flush() |
Line 1136 class ZSQLExtendFolder(Folder,Persistent
|
Line 1151 class ZSQLExtendFolder(Folder,Persistent
|
table=urllib.unquote(value) |
table=urllib.unquote(value) |
elif name=="-identify": |
elif name=="-identify": |
identify=urllib.unquote(value) |
identify=urllib.unquote(value) |
identify="lower("+identify.split("=")[0]+")="+sql_quote(identify.split("=")[1].lower()) |
# old code did identify with lower() which doesn't work for oids |
|
#identify="lower("+identify.split("=")[0]+")="+sql_quote(identify.split("=")[1].lower()) |
|
(k,v) = identify.split("=") |
|
identify="%s=%s"%(k,sql_quote(v)) |
elif name=="-format": |
elif name=="-format": |
format=urllib.unquote(value) |
format=urllib.unquote(value) |
#elif (not (name[0]=="-" or name[0]=="_")) and (not len(value)==0): |
#elif (not (name[0]=="-" or name[0]=="_")) and (not len(value)==0): |