Serj Zavadsky avatar Serj Zavadsky committed 1b902cb

added settings.HIDE_REQUEST_FIELD_VALUES

Comments (0)

Files changed (3)

 *.swp
 log.csv
 main
+.idea

djucsvlog/fields/request.py

 import json
 import djucsvlog.settings as my_settings
+
+
 def readable_dict(dd):
     if not dd:
         return '{}'
-    ret = ''
-    for kd,vd in dd.items():
-        ret += '\n"%s":%s,' %(unicode(kd),json.dumps(vd))
-    return '{'+ret[:-1]+'\n}'
+
+    ret = '\n'.join(
+        (u'"%s": %s' % (k,
+                        u'Value hidden because this field is in settings.HIDE_REQUEST_FIELD_VALUES' if k in my_settings.HIDE_REQUEST_FIELD_VALUES else json.dumps(v))
+        for k,v in dd.items())
+    )
+    return '{%s\n}' % ret
 
 def path(request):
     return request.path
     return int(request.is_ajax())
 
 def is_secure(request):
-    return int(request.is_secure())
+    return int(request.is_secure())

djucsvlog/settings.py

 get('REQ_REMOTE_ADDR_ANONYMOUSE','A')
 get('REQ_HTTP_HOST_NOHOST','_NH_')
 get('REQ_SAVE_FILES_FOLDER',None)
+get('HIDE_REQUEST_FIELD_VALUES', ['password', 'password1', 'password2',])
 
 
 ##
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.