dontclickit
Thursday, 11. May 2006, 11:57:54
Thursday, 11. May 2006, 11:57:54
Monday, 8. May 2006, 13:47:56
@cherrypy.expose
def doPost(self, url="", title="", notes="", tags=""):
con = cherrypy.thread_data.db.cursor()
user = ""
info = (title, url, notes, user, tags, time.time())
con.execute("insert into bookmark (title, url, notes, user, tags, time) values (?,?,?,?,?,?)", info)
cherrypy.thread_data.db.commit()
con.close()
yield '...... done!<br>'
yield 'go back to <a href="%s">%s</a>' % (url, title)
Sunday, 7. May 2006, 12:50:25
post to del.icio.us按钮,可以在浏览网页的时候随时保存,另外加上一些tag,使得归类是如此的简单。比起在Opera、FireFox、IE等浏览器上的书签系统要方便很多(难以想象在本地对几百个书签进行分类、查找)。javascript:location.href='http://localhost:8000/?url='+encodeURIComponent(location.href)+';title='+encodeURIComponent(document.title)
import os, time
import cherrypy
from cherrytemplate import renderTemplate
from pysqlite2 import dbapi2 as sqlite
# add this before cherrypy server start
def connect(thread_index):
cherrypy.thread_data.db = sqlite.connect("contact.db")
cherrypy.server.on_start_thread_list.append(connect)
class BasePage:
def __init__(self, title=None):
self.title = 'Bookmark'
if title:
self.title += ' : %s' % title
@cherrypy.expose
def default(self, *args):
return '%s not available <a href="/">go back home</a>' % repr(args)
def header(self):
return renderTemplate(file='./template/header.html')
def navibar(self):
return renderTemplate(file='./template/navibar.html')
def footer(self):
yield '<p><font color="grey"> %s </font></p>' % repr(cherrypy.request.headers)
yield renderTemplate(file='./template/footer.html')
class PostRemote(BasePage):
""" supply remote post
you can make a button on youre bowser, whose URL should be:
javascript:location.href='http://localhost:8000/post?url='+
encodeURIComponent(location.href)+';title='+encodeURIComponent(document.title)
where 'http://localhost:8000/post' is the url of instance of PostRemote mounted on.
"""
def __init__(self):
BasePage.__init__(self, "post")
@cherrypy.expose
def index(self, url="", title=""):
return renderTemplate(file='./template/form_postremote.html')
@cherrypy.expose
def doPost(self, url="", title="", notes="", tags=""):
return "gotcha"
cherrypy.root = PostRemote()
if __name__=="__main__":
cherrypy.config.update(file = 'tutorial.conf')
cherrypy.server.start()
Wednesday, 8. March 2006, 06:25:27
anonymous
Anonymous writes: Download: http://rapidshare.com/files/4986504 ...
anonymous
anonymous
anonymous
anonymous
xiemm writes: Do you think openfoam is good?? Can you write mor ...
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
| ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||
CommunityWiki
Emacs Wiki
如何网聚
读书、听歌、看电影