do_import.py
changeset 57 31271426f879
parent 56 6b31934e5b2e
child 58 004a32370ba5
equal deleted inserted replaced
56:6b31934e5b2e 57:31271426f879
     1 #!/usr/bin/python
       
     2 
       
     3 import sys
       
     4 import traceback
       
     5 sys.path.insert(0, "/home/fabien/lib/python")
       
     6 sys.path.insert(0, "./lib")
       
     7 sys.stderr = sys.stdout
       
     8 
       
     9 print "Content-type: text/html; charset=iso-8859-1;"
       
    10 print
       
    11 
       
    12 # import cgitb; cgitb.enable()
       
    13 import cgi
       
    14 import time
       
    15 from utils import unique
       
    16 import my_db
       
    17 from webutils import load_index
       
    18 import os
       
    19 from xbelimp import parse_xbel, import_bookmarks
       
    20 
       
    21 if (__name__ == "__main__"):
       
    22     form = cgi.FieldStorage()
       
    23     db = my_db.connect(os.environ["REMOTE_USER"])
       
    24     prefs = db.get_preferences()
       
    25     file = form["xbelfile"].file
       
    26     bms = parse_xbel(file)
       
    27     import_bookmarks(db, bms)
       
    28     load_index(db, prefs)