def isbn_query(isbn): title = 'ISBN 검색: %s' % (isbn,) cgiutil.print_header(title, 'style.css') print '<form action="lt.cgi" method="post">' cgiutil.start_table() do_isbn_query(isbn) return_link() cgiutil.end_table() print '</form>' cgiutil.print_footer()
def isbn_form(): cgiutil.print_header('ISBN 검색', 'style.css') print '<form action="lt.cgi" method="get">' print '<p>' print '<label for="isbn">ISBN</label>' print '<input name="isbn" id="isbn" size="13">' print '<input type="submit" value="검색">' print '</p>' print '</form>' print '<p>' print '<a href="demo/demo1.html">데모 버전 보기</a>' print '</p>' cgiutil.print_footer()
def isbn_post(form): cgiutil.print_header('책 등록', 'style.css') print '<p>' print_progress('LibraryThing에 로그인합니다') api = ltapi.signup(account.username, account.password) if not api: print '실패했습니다.<br>' print '</p>' return print_progress('책을 등록합니다') api.update(form) isbn = form.getvalue('isbn') print_progress('방금 등록한 책의 ID를 가져옵니다') bookid = api.get_bookid(isbn) print_info('bookid', bookid) print_progress('표지를 올립니다') cover = form.getvalue('cover') api.set_cover(bookid, cover) authorid = form.getvalue('authorid') workid = form.getvalue('workid') thisid = ltapi.get_lastpart(ltapi.link_isbn(isbn)) if workid: print_progress('책을 원서와 엮을 준비를 합니다') title = form.getvalue('title') worktitle = cgiutil.encode(api.get_worktitle(bookid)) print_info('title', title) print_info('worktitle', worktitle) if title != worktitle: print '책이 이미 엮여 있습니다.<br>' else: print_info('authorid', authorid) print_info('workid', workid) print_info('thisid', thisid) print_progress('책을 엮습니다') api.work_combine(authorid, workid, thisid) else: print '책을 엮지 않습니다.<br>' url = 'http://www.librarything.com/work/%s/details/%s' % (thisid, bookid) print '<a href="%s">등록되었습니다</a>.<br>' % (url,) print '</p>' return_link() cgiutil.print_footer()