[Zope3-checkins] CVS: Zope3/src/zope/app/browser/security - permissionwidget.py:1.7

Jim Fulton jim@zope.com
Fri, 7 Mar 2003 16:15:16 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/security
In directory cvs.zope.org:/tmp/cvs-serv8587

Modified Files:
	permissionwidget.py 
Log Message:
Updated permission widgets to properly handle CheckerPublic/zope.Public.


=== Zope3/src/zope/app/browser/security/permissionwidget.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/security/permissionwidget.py:1.6	Tue Feb 11 21:17:08 2003
+++ Zope3/src/zope/app/browser/security/permissionwidget.py	Fri Mar  7 16:14:37 2003
@@ -20,6 +20,8 @@
 from zope.app.browser.form import widget
 from zope.component import getService
 from zope.app.services.servicenames import Permissions
+from zope.security.checker import CheckerPublic
+
 
 class BaseWidget:
 
@@ -30,6 +32,14 @@
             except UnicodeError, v:
                 raise ConversionError("Invalid textual data", v)
 
+        if permission_id == 'zope.Public':
+            permission_id = CheckerPublic
+
+        return permission_id
+
+    def _unconvert(self, permission_id):
+        if permission_id is CheckerPublic:
+            permission_id = 'zope.Public'
         return permission_id
 
 class SinglePermissionWidget(BaseWidget, widget.BrowserWidget):