惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Register - Security
The Register - Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MyScale Blog
MyScale Blog
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
aimingoo的专栏
aimingoo的专栏
C
Check Point Blog
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
L
LangChain Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Security @ Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理
H
Hacker News: Front Page
L
Lohrmann on Cybersecurity
T
Troy Hunt's Blog
T
Threat Research - Cisco Blogs
A
About on SuperTechFans
T
Threatpost
AWS News Blog
AWS News Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
Tor Project blog
Google Online Security Blog
Google Online Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tenable Blog
W
WeLiveSecurity
博客园 - 叶小钗
K
Kaspersky official blog
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
M
MIT News - Artificial intelligence
Hacker News - Newest:
Hacker News - Newest: "LLM"
Engineering at Meta
Engineering at Meta
有赞技术团队
有赞技术团队
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Secure Thoughts
小众软件
小众软件
D
Docker
爱范儿
爱范儿
C
Cyber Attacks, Cyber Crime and Cyber Security
N
News and Events Feed by Topic
S
Schneier on Security
博客园 - 三生石上(FineUI控件)
D
DataBreaches.Net

博客园 - 永不言败

JavaScript 语言基础知识点总结(思维导图) 关于Visual Studio项目系统属性中的宏 MongoDb的相关资料 javascript apply 和call的区别,javascript设计模式 Adding a QR Code Reader in Flex on Android castle 在mvc3如何注入 Castle Automatic Transaction Management python webpy模板介绍 使用 asp.net mvc和 jQuery UI 控件包 Howto create a System.Linq.Expressions.Expression for Like 实体框架继承关系。很好 淘宝店铺图片数据迁移核心代码 mvc扩展 ASP.NET MVC 2 Templates C#、VB.NET使用HttpWebRequest访问https地址(SSL)的实现 Nhibernate继承 Castle 容器注入学习例子 javaScript 运算符 && 和 || 的返回值 event.x,event.clientX,event.offsetX区别
webpy demo核心代码
永不言败 · 2011-07-01 · via 博客园 - 永不言败

# -*-encoding:utf-8 -*-

"""Basic Blog using webpy 0.3 """import web
import config
import controllers

app

= web.application(config.urls,globals())if __name__ =='__main__':
app.run()
class Index:def GET(self):
web.header(
'Content-Type','text/html;charset=UTF-8')
web.setcookie(
"age",30)

posts

=model.get_posts()
return render.index(posts,web.cookies())class View:def GET(self,id):
""" View sing post """
post
= model.get_post(int(id))
print datetime.datetime.strptime('2009-9-9 16:56:58','%Y-%m-%d %H:%M:%S')
print datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
return render.view(post)class New:
#vtitle = web.form.regex(r".{3,20}$", '标题长度3到20位字符')
form=web.form.Form(
web.form.Textbox(
'title',web.form.notnull,
size
=30,
description
=u"标题"),
web.form.Textarea(
'content',web.form.notnull,
rows
=30,cols=80,
description
=u"内容"),
web.form.Button(
'submit',type="submit",html=u'提交'),

)

def GET(self):
form
= self.form()return render.new(form)def POST(self):
form
= self.form()
if not form.validates():
return render.new(form)
model.new_post(form.d.title,form.d.content)
raise web.seeother('/')class Delete:
def POST(self,id):
model.del_post(int(id))
raise web.seeother('/')class Edit:def GET(self,id):
post
= model.get_post(int(id))
form
= New.form()
form.fill(post)
return render.edit(post,form)def POST(self,id):
form
=New.form()
post
= model.get_post(int(id))
if not form.validates():
return render.edit(post,form)
model.update_post(int(id),form.d.title,form.d.content)
raise web.seeother('/')def notfound():
return web.notfound("Sorry, the page you were looking for was not found.")

model.py

import web,datetime
db
= web.database(dbn='sqlite',db='blog.db')def get_posts():
return db.select('entries',order='id desc')def get_post(id):
try:
return db.select('entries',where='id=$id',vars=locals())[0]
except IndexError:
return Nonedef new_post(title,text):

db.insert(

'entries',title=title,content=text,post_on=datetime.datetime.utcnow())def del_post(id):
db.delete(
'entries',where="id=$id",vars=locals())def update_post(id,title,text):
db.update(
'entries',where="id=$id",vars=locals(),
title
=title,content=text)