Minor bug fixee, replace double quotes with single quotes in strings so that R can read the resulting table
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4910 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
a31f6e4e99
commit
501d44fa04
|
|
@ -193,15 +193,21 @@ class RecordAsTable(StageHandler):
|
|||
val = parsed[field]
|
||||
if val == None:
|
||||
if OPTIONS.verbose: print >> sys.stderr, 'field', field, 'is missing in', parsed['id']
|
||||
elif val.find(" ") != -1:
|
||||
val = "\"" + val + "\""
|
||||
else:
|
||||
val = val.replace('"',"'")
|
||||
# if val.find("\t") != -1:
|
||||
# if OPTIONS.verbose: print >> sys.stderr, 'Warning -- val', val, 'contains tabs, droping field', field
|
||||
# raise Error
|
||||
#val = "value contained tabs, dropped"
|
||||
if val.find(" ") != -1:
|
||||
val = "\"" + val + "\""
|
||||
return val
|
||||
try:
|
||||
print >> self.out, "\t".join([ oneField(field) for field in self.decoder.fields ])
|
||||
except:
|
||||
print 'Failed to convert to table ', parsed
|
||||
pass
|
||||
#print 'Failed to convert to table ', parsed
|
||||
|
||||
|
||||
addHandler('table', RecordAsTable)
|
||||
|
||||
class CountRecords(StageHandler):
|
||||
|
|
|
|||
Loading…
Reference in New Issue