Commits

Alexander Lyabah committed 20de0de

working update

Comments (0)

Files changed (4)

djucsvlog/fields/request.py

             file_object.seek(0)
             break
         yield data
+        
 import os
 def find_place_to_store(name):
     from random import randint
         
 
 def save_files(request):
-    assert my_settings.REQ_SAVE_FILES_FOLDER , 'UCSVLOG_REQ_SAVE_FILES_FOLDER must be set for using save_files'
+    if not my_settings.REQ_SAVE_FILES_FOLDER:
+        return
 
     if not request.FILES:
         return '{}'
         fh.close()
     
     return '{'+ret+'}'
-        
+        
+def http_referer(request):
+    return request.META.get('HTTP_REFERER','')
+
+def http_accept_language(request):
+    return request.META.get('HTTP_ACCEPT_LANGUAGE','')
+
+def is_ajax(request):
+    return int(request.is_ajax())
+
+def is_secure(request):
+    return int(request.is_secure())

djucsvlog/fields/response.py

     return response._headers['content-type'][1]
 def content(request,response):
     return response._headers['content-type'][1].lower() in settings.RESPONSE_CONTENT_LOG_TYPES and response.content or ''
+
+def headers(request,response):
+    import json
+    return json.dumps(response._headers)

djucsvlog/middleware.py

     def process_request(self,request):
         self.mid_a_log(my_settings.VIEW_LOG_NAME,glog.arr_funcs(glog.arr_lambda_by_name(my_settings.VIEW_OPEN_FIELDS,request_fields),request))
     
-    def process_response(self,request,response):
-        if my_settings.VIEW_CLOSE_FIELDS:
-            self.mid_c_log(my_settings.VIEW_LOG_NAME,glog.arr_funcs(glog.arr_lambda_by_name(my_settings.VIEW_CLOSE_FIELDS,request_fields),request,response))
-        return response
         
         
 

djucsvlog/settings.py

 get('EXCEPTION_TOP_NAME','TOP')
 get('EXCEPTION_MIDDLE_NAME','IN')
 get('VIEW_OPEN_FIELDS',['userid'])
-get('VIEW_CLOSE_FIELDS',None) 
 get('REQUEST_FIELDS',['remote_addr','path','request_form_data','http_user_agent']) # request logged fields
-get('RESPONSE_FIELDS',['ctype','content']) #response logged fields
+get('RESPONSE_FIELDS',['ctype','content','status']) #response logged fields
 get('RESPONSE_CONTENT_LOG_TYPES',['text/json','text/xml','application/json','application/xml'])
 get('EXCEPTION_FIELDS',['estr','etype'])
 get('EXCEPTION_STACK_FIELDS',['sfunction','sfilename','slineno','svars'])