Exemple #1
0
def logevent(request,action,result=None,info=None,changepasswordrequest=None,registration=None):
    event = ServerLog()
    event.action = action
    ##event.result = repr(result)
    event.info = repr(result) + "/" + repr(info)
    event.when = int(time.time()*1000);
    event.url = request.get_full_path()
    event.host = request.get_host()
    user = basicauth_get_user(request);
    if user:  event.user = user
    event.changepasswordrequest = changepasswordrequest
    event.registration = registration
    event.save()
    return event
Exemple #2
0
def post_usage_statistics(request):
    print "usage stats"
    print request.raw_post_data
    try:
        slog = ServerLog()
        request_user = basicauth_get_user_by_emailaddr(request)
        if request_user:
            slog.user = request_user
        slog.when = current_time_decimal()
        slog.action = "usage_statistics"
        slog.info = request.raw_post_data
        slog.host = ""
        slog.url = "post_diagnostics"
        slog.request = ""
        slog.save()
        return json_response("[]", 200)
    except:
        excinfo = sys.exc_info()
        response = HttpResponse(repr(excinfo), 'text/html')
        response.status_code = 500
        return response
Exemple #3
0
def post_usage_statistics(request):
    print "usage stats"
    print request.raw_post_data
    try:
        slog = ServerLog()    
        request_user = basicauth_get_user_by_emailaddr(request);    
        if request_user:
            slog.user = request_user
        slog.when = current_time_decimal()
        slog.action = "usage_statistics"
        slog.info = request.raw_post_data
        slog.host = ""
        slog.url="post_diagnostics"
        slog.request=""
        slog.save()
        return json_response("[]", 200);
    except:
        excinfo = sys.exc_info()
        response = HttpResponse(repr(excinfo), 'text/html');
        response.status_code = 500
        return response