示例#1
0
        def recreateRequest(self, request):
            reqargs = RequestArgument.objects.filter(request=self)
            onedict = {}
            multidict = QueryDict('', mutable=True)
            for arg in reqargs:
                onedict[arg.name] = arg.value
                multidict.appendlist(arg.name, arg.value)
            if ('format' in getDataFromRequest(request)):
                argname = unicode('format')
                argvalue = getDataFromRequest(request).get('format')
                onedict[argname] = argvalue
                multidict.appendlist(argname, argvalue)
            redata = multidict.copy()
            redata.update(onedict)

            return HttpRequestReplay(request, self.path, onedict)
示例#2
0
文件: models.py 项目: xgds/xgds_data
        def recreateRequest(self, request):
            reqargs = RequestArgument.objects.filter(request=self)
            onedict = {}
            multidict = QueryDict('', mutable=True)
            for arg in reqargs:
                onedict[arg.name] = arg.value
                multidict.appendlist(arg.name, arg.value)
            if ('format' in getDataFromRequest(request)):
                argname = unicode('format')
                argvalue = getDataFromRequest(request).get('format')
                onedict[argname] = argvalue
                multidict.appendlist(argname, argvalue)
            redata = multidict.copy()
            redata.update(onedict)

            return HttpRequestReplay(request, self.path, onedict)
示例#3
0
def recordRequest(request):
    """
    Logs the request in the database
    """
    if logEnabled():
        data = getDataFromRequest(request)
        reqlog = RequestLog.create(request)
        reqlog.save()
        args = []
        for a in data.keys():
            args = args + [RequestArgument(request=reqlog, name=a, value=handleFunnyCharacters(v)) for v in data.getlist(a) if v.strip() != '']

        RequestArgument.objects.bulk_create(args)

        return reqlog
    else:
        return None