摘要: 看了廖老师的教程实现了这个模块,按照自己的思路实现了一个,代码附下。需要说名的几点:1. dbcontext继承自threading.local,确保每个线程中都有独立的一个dbcontext对象,保证个用户数据独立。2. connection对象是对dbcontext对象的一个封装,实现了getc... 阅读全文
posted @ 2015-04-16 16:59 cncyber 阅读(1561) 评论(0) 推荐(0) 编辑
摘要: 测试代码如下: 1 class ModelMetaClass(type): 2 def __new__(cls,name,base,attrs): 3 logging.info("cls is:"+str(cls)) 4 logging.info("name ... 阅读全文
posted @ 2015-04-15 20:59 cncyber 阅读(2087) 评论(0) 推荐(0) 编辑
摘要: 由于最近在阅读python项目源码,想找一个python的函数调用关系图生成模块,就找到了pycallgraph。遂将安装过程记录于此:1.pycallgraph模块下载:http://pycallgraph.slowchop.com/这个就不细说了,但是安装过后运行示例会报错:The comman... 阅读全文
posted @ 2015-04-14 21:50 cncyber 阅读(3116) 评论(0) 推荐(0) 编辑