getattribute
属性访问拦截器
class Itcast(object):
def __init__(self,subject1):
self.subject1 = subject1
self.subject2 = "go"
#属性访问拦截器,打log
def __getattribute__(self, item):
print("---1>%s" %item)
if item == "subject1":
print("log subject1")
return 'redirect python'
else:
temp = object.__getattribute__(self,item)
print("---2>%s"%str(temp))
return temp
def show(self):
print("this is Itcast") s = Itcast("python")
print("--------1--------")
print(s.subject1)
print("--------2--------")
print(s.subject2)
print("--------3--------")
s.show()
print("--------4--------")
输出
--------1--------
---1>subject1
log subject1
redirect python
--------2--------
---1>subject2
---2>go
go
--------3--------
---1>show
---2><bound method Itcast.show of <__main__.Itcast object at 0x000001F47161A860>>
this is Itcast
--------4--------
getattribute的更多相关文章
- request中getParameter和getAttribute的区别
整理一下getParameter和getAttribute的区别和各自的使用范围. (1)HttpServletRequest类有setAttribute()方法,而没有setParameter()方 ...
- getAttribute、setAttribute、removeAttribute
1.函数语法 elementNode.attributes:属性返回包含被选节点属性的 NamedNodeMap. elementNode.getAttribute(name):方法通过名称获取属性的 ...
- request:getParameter getAttribute
转载自:http://www.cnblogs.com/shaohz2014/p/3804656.html 在浏览器地址输入,表示传入一个参数test,值为123 http://localhost:88 ...
- sizzle分析记录:getAttribute和getAttributeNode
部分IE游览器下无法通过getAttribute取值? <form name="aaron"> <input type="text" name ...
- request属性 request.getAttribute()
一.request.getParameter() 和request.getAttribute() 区别 (1)request.getParameter()取得是通过容器的实现来取得通过类似post,g ...
- request getParameter getAttribute
在浏览器地址输入,表示传入一个参数test,值为123 http://localhost:8888/Test/index.jsp?test=123 在index.jsp中尝试使用EL表达式取出,代码如 ...
- setAttribute,,,getAttribute,,,,
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- JQuery 1.8.3对IE9兼容问题getAttribute
jQuery1.8.3在IE9下attr报错问题 jQuery1.8.3在IE9中attr方法保存. 解决方案如下: r = e.getAttribute(n); 修改为: r = e.getAttr ...
- getattribute()与getparameter()的区别
1.它们取到的值不同.getAttribute取到的是对象(object),而getParameter取到的是String. 2.数据传递路劲不同.request.getParameter方法传递的数 ...
- 【JSP手记】--jsp里面session.getAttribute("×××")在java中的表示
JSP里面的 <%=session.getAttribute("×××")%> 与java等价于 request.getSession().get ...
随机推荐
- 『TensorFlow』读书笔记_进阶卷积神经网络_分类cifar10_上
完整项目见:Github 完整项目中最终使用了ResNet进行分类,而卷积版本较本篇中结构为了提升训练效果也略有改动 本节主要介绍进阶的卷积神经网络设计相关,数据读入以及增强在下一节再与介绍 网络相关 ...
- 大家多开发点uwp吧
未来一定是平板,笔记本合二为一的市场,微软的应用就是太少了.不过能通用的确实比较爽gest
- html5(二)
*{ margin:0px; padding:0px;} h1{ font:bold 20px verdana,sans-serif;} h1{ font:bold 14px verdana,sans ...
- 告诉你们!我是怎么与Linux系统接触的!
最开始接触Linux是在15年来北京后,刚来北京机缘巧合,从事了实施工程师的工作.实施工作是一个面很广的工作.业务.技术.沟通等等方方面面的.技术一直是我是的短板.刚开始,公司在要在阿里云上部署APP ...
- java变量的作用域和基本数据类型转换
1.变量的作用域 赋值运算符 变量名 = 表达式 列: a = (b+3)+(b-1) 表达式就是符号(如:加号,减号)与操作数(如:b,3)的组合 自动类型转换(隐式类型转换):从小类型到大类型可以 ...
- Beta 冲刺 (6/7)
Beta 冲刺 (6/7) 队名:第三视角 组长博客链接 本次作业链接 团队部分 团队燃尽图 工作情况汇报 张扬(组长) 过去两天完成了哪些任务 文字/口头描述 组织会议 开发wxpy部分功能 展示G ...
- mysql装完计算机管理里面没mysql服务怎么解决(转)
mysql装完计算机管理里面没mysql服务怎么解决 2017年07月04日 09:32:51 XC_Echizen 阅读数:7335 标签: mysql计算机mysql服务找不到mysql服务 更多 ...
- Linux磁盘挂载
mount命令 用于加载文件系统到指定的加载点.此命令的最常用于挂载cdrom,使我们可以访问cdrom中的数据,因为你将光盘插入cdrom中,Linux并不会自动挂载,必须使用Lin ...
- 补码的来源以及为什么byte的最小值是-128
1. 有符号数和无符号数 我们的实数分为正数和负数和0三部分 Byte数据类型一共有8位,如果是无符号数,最大可以表示的数为11111111 = 256 -1 = 255 无符号数代指不 ...
- 读取txt数据存入数据库中
http://blog.csdn.net/daditao/article/details/18899469