1.django中views.py的as_view()类视图解析
Django 知识库:as_view()解析 - 杜赛的博客
2.函数参数*args和**args的区别:
Python函数中参数* 和 ** 的区别 - 3WLineCode - 博客园
3.is_authenticated()方法结合自定义login使用:
自己写登陆验证及借用auth的is_authenticated验证是否登陆 - 代码家园 - 博客园
4.自动发邮件报错:
SMTPAuthenticationError: (535, '5.7.8 authentication failed')
自动发邮件代码:
connection = get_connection(username=None, password=None,fail_silently=False)
send_mail(
subject=title,
message=message,
connection = connection,
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=toPeople)
connection.close()
#settings.py 相关邮件配置
#使用默认的认证后端
AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
)
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = False
EMAIL_HOST = 'mail.sh.pegatroncorp.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'BU3_ATS_SCM'
EMAIL_HOST_PASSWORD = 'SUzhouf8@gitmail'
DEFAULT_FROM_EMAIL = 'BU3_ATS_SCM@pegatroncorp.com'
SITE_ALLPROJECTINFO= {}
5.通过触发器执行python脚本
CREATE TABLE userinfo(
id int NOT NULL primary key AUTO_INCREMENT comment 'primary key',
names varchar(255) comment 'username',
sex int(5) comment 'sex',
age int(3) comment 'age'
) default charset utf8;
CREATE Table updateData(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT comment 'primery key',
userifoId int comment 'userinfo ID',
names varchar(255) comment 'username',
sex int(5) comment 'sex',
age int(3) comment 'age'
) default charset utf8;
DELIMITER ||
create trigger executeStatus after update on userinfo for each row
begin
declare cmd varchar(255);
declare res varchar(255);
if OLD.sex=0 and NEW.sex=1 then
set cmd="python3 /data/django/ATS_Web_Test/Apps/sendEmail/tests.py 执行成功";
set res=sys_exec(cmd);
end if;
if OLD.sex=1 and NEW.sex=0 then
set cmd="python3 /data/django/ATS_Web_Test/Apps/sendEmail/tests.py 执行失败";
set res=sys_exec(cmd);
end if;
END;
DELIMITER ;
drop trigger executeStatus;
update userinfo set sex=0 where id=1;
update userinfo set sex=1 where id=0;
UDF介绍 有安全风险
linux环境下,mysql UDF的实现编译及安装_xiweiwei的专栏-优快云博客
MySQL UDF(自定义函数) - Sky_Raker - 博客园
signals+触发器
def autoSend(title,message,toPeople,cc):
flag=False
try:
connection = get_connection(username=None, password=None,fail_silently=False)
connection.open()
EmailMessage(
subject=title,
body=message,
from_email=settings.DEFAULT_FROM_EMAIL,
to=toPeople,
cc=cc).send()
connection.close()
flag=True
except Exception as e:
print("自动发送邮件失败信息:",e)
return flag
django返回数据到ajax
Django 返回数据 到ajax - 绝世老中医 - 博客园
//服务器
def index(request):
# django返回数据到ajax:HttpResponse JsonResponse
# 1.HttpResponse返回字符串
# return HttpResponse("返回字符串")
# 2.HttpResponse返回序列化Json数据,前端需要手动反序列化
# return HttpResponse(json.dumps({'x':11,'y':22}))
# 3.HttpResponse返回序列化Json数据,并设置content_type参数,前端自动反序列化.告知类型,前端自动调用JSON对象解析
# return HttpResponse(json.dumps({'x':11,'y':22}),content_type='application/json')
# 4.JsonResponse返回字典数据(无需序列化),前端自动反序列化
# return JsonResponse({'x':11,'y':22})
# 5.JsonResponse返回非字典数据,并设置safe=False数据,前端自动反序列化
return JsonResponse([{'x':11,'y':22}],safe=False)
//js
$.ajax({
url:'/index/',
// async用于设置访问服务器的方式:同步,异步
// 同步(async:false):只有ajax与服务器通信结束时,才会继续执行后面的js代码
// 异步(async:true 默认为true):ajax与服务器通信的同时,继续执行后面的js代码
async:false,
success:function(data){
flag=123;
alert("enter ajax");
// 1.HttpResponse string
// alert(data);
// 2.HttpResponse Json
// alert(JSON.parse(data)['x']);
// alert(JSON.parse(data).y);
// 3.HttpResponse json content_type='application/json'
// alert(data.x);
// 4.JsonResponse dict
// alert(data.x);
// 5.JsonResponse not dict safe=False
// alert(data[0].x);
},
error:function(XMLHttpRequest,textStatus){
alert("error");
}
});
启动软体测试
detect.lua
自动侦测device
|
group.lua
groupSetup:
syntaxCheck = require("Matchbox/CheckCSVSyntax")
检查assetspath下csv语法并
加载main,limits,init,teardown.csv文件
加载group plugin(Regex,RunShellCommand)
|
group.lua
unitDetection:
侦测slot start
->plugins.lua getslots()
|
groupStart
clone init,main,teardown
|
deviceStart
->plugins.lua loadPlugins()
加载plugin
|
scheduleDAG
执行init,main的测项
|
scheduleFinalDAG
执行Teardown的测项
|
deviceTeardown
->plugins.lua deviceTeardown()
释放plugins
|
loopAgain
控制循环测试,如果返回值为True,继续下一次测试,否则结束测试
https://zhuanlan.zhihu.com/p/479064200
https://wenku.baidu.com/view/e38d920e0422192e453610661ed9ad51f01d5492.html