Changeset 4055 for TI02-CSML


Ignore:
Timestamp:
21/07/08 12:04:50 (11 years ago)
Author:
domlowe
Message:

minor config updates to online parser

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/webparser/parseTest.py

    r4044 r4055  
    1  
     1#!/usr/bin/python 
     2import logging 
     3logging.basicConfig(level=logging.DEBUG, filename='logs/parser2.log') 
    24import cgi 
    35from cElementTree import * 
     
    79import elementtree.ElementTree as etree 
    810import traceback 
     11logging.debug('imports all ok') 
     12 
    913"""Test for GML/CSML parsing code 
    1014""" 
     
    8286 
    8387def main(): 
     88    logging.debug('starting main') 
    8489    sys.stderr = sys.stdout  
    8590    print "Content-type: text/html" 
     
    96101    print "<h1>CSML Version 2 Test Parser</h1>" 
    97102    print "<p>Please note this is experimental, any questions please contact d.lowe@rl.ac.uk</p>" 
    98     print "<p>Parser version - 28 February 2007 - includes NDG security elements, fixed unicode encoding</p>"     
    99     print "<h2>Load a CSML file to test:</h2>"     
     103    print "<p>Parser version - 18 July 2008 - moved to new server and update parser to latest from svn</p>"     
     104    print "<h2>Load a CSML file to test against the parser:</h2>"     
     105    logging.debug('ready to load form') 
    100106    form= cgi.FieldStorage() 
     107    logging.debug('initialised form %s'%form) 
    101108    if not form: 
    102         print """<form action="http://glue.badc.rl.ac.uk/cgi-bin/csml2/parseTest.py" method="POST" enctype="multipart/form-data">  <input type="file" name="filename"> <input type="submit"></form>"""     
     109        logging.debug('not form') 
     110        print """<form action="http://csml.badc.rl.ac.uk/cgi-bin/parseTest.py" method="POST" enctype="multipart/form-data">  <input type="file" name="filename"> <input type="submit"></form>"""     
    103111    elif form.has_key("filename"): 
    104112        item = form["filename"] 
     
    107115            #print cgi.escape(data) 
    108116            #data1 = cgi.escape(data) 
    109             f = open("/tmp/tempcsml.xml","wb") 
     117            f = open("temp/tempcsml.xml","wb") 
    110118            f.write(data) 
    111119            f.close() 
     
    122130            # 1. Test parsing from CSML file 
    123131            try: 
    124                 tree = ElementTree(file='/tmp/tempcsml.xml') 
     132                tree = ElementTree(file='temp/tempcsml.xml') 
    125133            except: 
    126134                traceback.print_exc() 
     
    134142            except: 
    135143                traceback.print_exc() 
    136                 print "<p>Could not parse CSM, problem reading XML into objects.</p>" 
     144                print "<p>Could not parse CSML, problem reading XML into objects.</p>" 
    137145                sys.exit() 
    138146             
     
    162170                    break 
    163171            print "</HEAD>" 
     172    logging.debug('end of main') 
    164173main() 
    165174 
Note: See TracChangeset for help on using the changeset viewer.