[Checkins] SVN: z3c.securitytool/trunk/src/z3c/securitytool/browser/view Made some changes to the viewprincipalmatrix.pt to be more user

Daniel Blackburn blackburnd at gmail.com
Tue Jan 15 11:06:08 EST 2008


Log message for revision 82896:
  Made some changes to the viewprincipalmatrix.pt to be more user
  freindly
  
  
  

Changed:
  U   z3c.securitytool/trunk/src/z3c/securitytool/browser/viewprincipalmatrix.pt
  U   z3c.securitytool/trunk/src/z3c/securitytool/browser/views.py

-=-
Modified: z3c.securitytool/trunk/src/z3c/securitytool/browser/viewprincipalmatrix.pt
===================================================================
--- z3c.securitytool/trunk/src/z3c/securitytool/browser/viewprincipalmatrix.pt	2008-01-15 12:45:36 UTC (rev 82895)
+++ z3c.securitytool/trunk/src/z3c/securitytool/browser/viewprincipalmatrix.pt	2008-01-15 16:06:08 UTC (rev 82896)
@@ -34,6 +34,7 @@
    <table tal:define="urlViewName view/urlEncodedViewName">
       <tr>
          <th></th>
+         <th></th>
          <th tal:repeat="principal view/viewMatrix">
              <a tal:content="principal"
                 tal:attributes="href string:ud.html?principal=${principal}">Principal</a>
@@ -43,9 +44,11 @@
           tal:attributes="class view/cssclass">
          <td>
             <span tal:content="structure viewName"
-                  class="viewname"/><br />
-            <span class="permission">
-            (<span tal:content="python: view.views[viewName]"
+                  class="viewname"/>
+         </td>
+         <td>
+            <span class="permission">
+            (<span tal:replace="python: view.views[viewName]"
                    tal:omit-tag="">Read Permission</span>)
             </span>
          </td>

Modified: z3c.securitytool/trunk/src/z3c/securitytool/browser/views.py
===================================================================
--- z3c.securitytool/trunk/src/z3c/securitytool/browser/views.py	2008-01-15 12:45:36 UTC (rev 82895)
+++ z3c.securitytool/trunk/src/z3c/securitytool/browser/views.py	2008-01-15 16:06:08 UTC (rev 82896)
@@ -21,6 +21,7 @@
     
     evenOddClasses = ('even','odd')
     evenodd = 0
+    viewList = {}
     
     def update(self):
         selectedPermission = None
@@ -40,6 +41,19 @@
         self.viewMatrix, self.views, self.permissions = \
             security_checker.getPermissionSettingsForAllViews(ifaces, skin,
             selectedPermission)
+
+        # self.views is a dict in the form of {view:perm}
+        # Here It would make more sense to group by permission rather than view
+        sortedViews = sorted([(v,k) for k,v in self.views.items()])
+
+
+        for item in sortedViews:
+            if self.viewList.has_key(item[0]):
+                self.viewList[item[0]].append(item[1])
+            else:
+                self.viewList[item[0]] = [item[1]]
+                            
+        self.viewList
         
     def cssclass(self):
         if self.evenodd != 1:



More information about the Checkins mailing list