Beispiel #1
0
class Activity(object):
        def process_request(self,request):
                if request.META.has_key('HTTP_REFERER'):
                        referer = request.META['HTTP_REFERER']
                else:
                        referer = ''

                self.activity = UserActivity(
                                user = request.user,
                                session = request.session,
                                date = datetime.now(),
                                request_url = request.META['PATH_INFO'],
                                referer_url = referer,
                                client_address = request.META['REMOTE_ADDR'],
                                client_host = '',
                                browser_info = request.META['HTTP_USER_AGENT']
                                )

        def process_exception(self,request,exception):
                self.activity.error = exception
                self.activity.save()

        def process_response(self,request,response):
                self.activity.set_request_time()
                return response
Beispiel #2
0
        def process_request(self,request):
                if request.META.has_key('HTTP_REFERER'):
                        referer = request.META['HTTP_REFERER']
                else:
                        referer = ''

                self.activity = UserActivity(
                                user = request.user,
                                session = request.session,
                                date = datetime.now(),
                                request_url = request.META['PATH_INFO'],
                                referer_url = referer,
                                client_address = request.META['REMOTE_ADDR'],
                                client_host = '',
                                browser_info = request.META['HTTP_USER_AGENT']
                                )