[Python-checkins] r84250 - in tracker/instances/python-dev: extensions/suppress_history.py html/user.item.html

martin.v.loewis python-checkins at python.org
Sun Aug 22 08:25:55 CEST 2010


Author: martin.v.loewis
Date: Sun Aug 22 08:25:55 2010
New Revision: 84250

Log:
Suppress display of user history to anybody but the user.


Added:
   tracker/instances/python-dev/extensions/suppress_history.py   (contents, props changed)
Modified:
   tracker/instances/python-dev/html/user.item.html

Added: tracker/instances/python-dev/extensions/suppress_history.py
==============================================================================
--- (empty file)
+++ tracker/instances/python-dev/extensions/suppress_history.py	Sun Aug 22 08:25:55 2010
@@ -0,0 +1,13 @@
+def is_history_ok(request):
+    user = request.client.userid
+    db = request.client.db
+    classname = request.classname
+    nodeid = request.nodeid
+    # restrict display of user history to user itself only
+    if classname == 'user':
+        return user == nodeid
+    # currently not used
+    return True
+
+def init(instance):
+    instance.registerUtil('is_history_ok', is_history_ok)

Modified: tracker/instances/python-dev/html/user.item.html
==============================================================================
--- tracker/instances/python-dev/html/user.item.html	(original)
+++ tracker/instances/python-dev/html/user.item.html	Sun Aug 22 08:25:55 2010
@@ -189,7 +189,9 @@
 </table>
 </tal:block>
 
+<tal:if condition="python:utils.is_history_ok(request)">
 <tal:block tal:condition="context/id" tal:replace="structure context/history" />
+</tal:if>
 
 </div>
 


More information about the Python-checkins mailing list