decorators.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Play.Excel 作者: abhijithasokan 项目源码 文件源码
def androidFriendly(view_func):
    @csrf_exempt    
    def new_view_func(request):
        print('Cookies: ',request.COOKIES,'\n\n\n',request.META)
        if request.method == 'POST':
            if request.META.get('HTTP_MOBILE',False):
                print('\n\nData: ',request.body,'\n\n')

                #temp = str(request.body)[2:-1].split('&')
                #try:
                request.POST = json.loads(request.body.decode('utf-8'))#.replace('\0', '')) 
                #except:
                #    request.POST = { i.split('=')[0] : convert(i.split('=')[1]) for i in temp }

        print("%s is about to be called"%view_func.__name__)
        ret = csrf_protect(view_func)(request)
        print("%s was called"%view_func.__name__)
        return ret
    return new_view_func
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号