Example #1
0
        def inner_wrapper(*args, **kwargs):
            his = History(type=asset_id, info=api_name, status=0)
            his.save()

            user, response = func(*args, **kwargs)

            his.user = user
            his.status = 1
            his.save()
            return response
Example #2
0
        def inner_wrapper(*args,**kwargs):
            his = History(type=asset_id, info=api_name, status=0)
            his.save()

            user,response = func(*args,**kwargs)

            his.user = user
            his.status = 1
            his.save()
            return response #别碰 这是魔法
Example #3
0
 def inner_wrapper(*args, **kwargs):
     request, is_validated = func(*args, **kwargs)
     history = History(type=timeline_type, )
     history.is_validated = is_validated
     history.info = request.data
     history.save()
     return is_validated  #DOT TOUCH it's magic
Example #4
0
    def form_valid(self, form):
        his=History(user=self.request.user,type=1,info="Bash脚本编辑",status=0)
        his.save()

        script_info=form.save()
        status=self.request.POST.get('status')
        if status == '0':
            script_info.status = 0
        else:
            script_info.status = 1
        script_info.save()

        his.status=1
        his.save()
        return super(OperationScriptUpdateView, self).form_valid(form)
Example #5
0
    def form_valid(self, form):
        his=History(user=self.request.user,type=4,info="修改应用",status=0)
        his.save()

        db=form.save()
        service_ip = self.request.POST.get('service_ip')
        db.root_passwd =  aes.encrypt(db.root_passwd)
        if Host.objects.filter(service_ip = service_ip).count() == 1:
            host = Host.objects.filter(service_ip=service_ip).get()
            db.host = host
        else:
            pass

        db.save()
        his.status=1
        his.save()
        return super(ApplicationDBUpdateView,self).form_valid(form)
Example #6
0
    def form_valid(self, form):
        his=History(user=self.request.user,type=3,info="修改用户",status=0)
        his.save()

        newuser=form.save()

        auths_id_list = self.request.POST.getlist('auths',[])
        auths = Group.objects.filter(id__in = auths_id_list)
        newuser.groups.add(*auths)

        is_active = self.request.POST.get('is_active')
        if is_active == 'actived':
            newuser.is_active=1
        else:
            newuser.is_active=0

        newuser.save()

        his.status=1
        his.save()
        return super(AuthorityUserUpdateView,self).form_valid(form)
Example #7
0
 def inner_wrapper(*args, **kwargs):
     results = func(*args, **kwargs)
     history = History(type=timeline_type, )
     history.is_validated = True
     history.save()
     return None  # DOT TOUCH it's magic
Example #8
0
 def inner_wrapper(*args, **kwargs):
     msg, response = func(*args, **kwargs)
     if 100 < response.status_code < 300:  # 200成功
         history = History(type=timeline_type, msg=msg)
         history.save()
     return response  #DOT TOUCH it's magic