Mercurial > p > roundup > code
comparison roundup/security.py @ 2834:3f93d4b29620
uh
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 27 Oct 2004 05:21:14 +0000 |
| parents | 673851f3fc0c |
| children | 9614a101b68f |
comparison
equal
deleted
inserted
replaced
| 2833:28f191863e36 | 2834:3f93d4b29620 |
|---|---|
| 116 Raise ValueError if there is no exact match. | 116 Raise ValueError if there is no exact match. |
| 117 ''' | 117 ''' |
| 118 if not self.permission.has_key(permission): | 118 if not self.permission.has_key(permission): |
| 119 raise ValueError, 'No permission "%s" defined'%permission | 119 raise ValueError, 'No permission "%s" defined'%permission |
| 120 | 120 |
| 121 if classname: | |
| 122 try: | |
| 123 self.db.getclass(classname) | |
| 124 except KeyError: | |
| 125 raise ValueError, 'No class "%s" defined'%classname | |
| 126 | |
| 121 # look through all the permissions of the given name | 127 # look through all the permissions of the given name |
| 122 for perm in self.permission[permission]: | 128 for perm in self.permission[permission]: |
| 123 # if we're passed a classname, the permission must match | 129 # if we're passed a classname, the permission must match |
| 124 if perm.klass is not None and perm.klass == classname: | 130 if perm.klass is not None and perm.klass == classname: |
| 125 return perm | 131 return perm |
