• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

学而精

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

2012年7月15日

Django API:输出文件 提供下载

摘要: Piston写的Handler:1. 简历j_handler类,继承Piston的BaseHandler。2. model为文件的model3. def 方法def read(self,request,sub_module)4. 处理(公司内部文件,不贴了)5. 提供文件下载:View Code data=json.dumps(li,indent=4,sort_keys=True) response = HttpResponse(data,mimetype='application/octet-stream') response['Content-Disposition 阅读全文

posted @ 2012-07-15 11:39 Songhan 阅读(559) 评论(0) 推荐(0)

CSV的编写

摘要: CSV:逗号分隔值。便于EXCEL阅读。Python实现:1.import csv2.f=open('test.csv', 'wt') 编写文件 writer=csv.writer(f) csv的编辑器 writer.writerow(['col1', 'col2', 'col3'])。 第一次一般为列名。以后为row的值代码:csvimport csvf=open('test.csv', 'wt')writer=csv.writer(f)writer.writerow([' 阅读全文

posted @ 2012-07-15 11:06 Songhan 阅读(369) 评论(0) 推荐(0)

XSS应对与防御

摘要: XSS的防范1.必须明确:一切输入都是有害的,不要信任一切输入的数据。2.对输入的数据进行转义保存,在输出时再进行还原;对输入的数据进行过滤,确保输入数据符合我们的期望(数据类型、长度、过滤空格/特殊字符、判断唯一性等)。 替换危险字符,如:"&", "<", ">", ""","'", "/", "?",";", ":", "%", "<SP 阅读全文

posted @ 2012-07-15 09:01 Songhan 阅读(1203) 评论(0) 推荐(0)

XSS介绍与攻击

摘要: XSS总览:Cross-Site Scripting attacks are a type of injection problem, in which malicious scripts are injected into the otherwise benign and trusted web sites. Flaws that allow these attacks to succeed are quite widespread and occuranywhere a web application uses input from a user in the output it gene 阅读全文

posted @ 2012-07-15 07:01 Songhan 阅读(3037) 评论(0) 推荐(0)

 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3