lib/actions/add.py
changeset 73 c078d8a04d76
parent 72 34fcc8b2c1f5
equal deleted inserted replaced
72:34fcc8b2c1f5 73:c078d8a04d76
     1 from templates import Template
     1 from templates import Template
     2 from bkmark import Bookmark
     2 from bkmark import Bookmark
     3 from webutils import load_index
     3 from webutils import load_index
     4 from templates import Template
     4 from templates import Template
       
     5 from keywords import add_unique_keywords
     5 import os
     6 import os
     6 
     7 
     7 def get_bk_from_form(form):
     8 def get_bk_from_form(form):
     8         bk = Bookmark()
     9         bk = Bookmark()
     9         bk.id = int(form['id'].value)
    10         bk.id = int(form['id'].value)
    33                 return []
    34                 return []
    34 
    35 
    35 def get_unique_keywords(form, db):
    36 def get_unique_keywords(form, db):
    36       kw = get_kw_from_form(form)
    37       kw = get_kw_from_form(form)
    37       kw = set(map(db.get_keyword, kw))
    38       kw = set(map(db.get_keyword, kw))
    38       return list(kw.union(get_new_kw_from_form(form))
    39       return list(kw.union(get_new_kw_from_form(form)))
    39 
    40 
    40 def edit(db, prefs, form, id):
    41 def edit(db, prefs, form, id):
    41     name = url = ""
    42     name = url = ""
    42     if form.has_key("ctitle"):
    43     if form.has_key("ctitle"):
    43         name = form["ctitle"].value
    44         name = form["ctitle"].value