do_import.py
branchxbelweb
changeset 26 17b0cd274530
child 43 4d194fce51e1
equal deleted inserted replaced
25:777bcb36f7be 26:17b0cd274530
       
     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 from htmltmpl import TemplateManager, TemplateProcessor
       
    15 import time
       
    16 from utils import unique
       
    17 import my_db
       
    18 from index import load_index
       
    19 import os
       
    20 from xbelimp import parse_xbel, import_bookmarks
       
    21 
       
    22 if (__name__ == "__main__"):
       
    23     form = cgi.FieldStorage()
       
    24     db = my_db.connect(os.environ["REMOTE_USER"])
       
    25     file = form["xbelfile"].file
       
    26     bms = parse_xbel(file)
       
    27     import_bookmarks(db, bms)
       
    28     load_index(db)