Show More
@@ -138,7 +138,8 b' class _PermCheckIterator(object):' | |||
|
138 | 138 | def __iter__(self): |
|
139 | 139 | for db_obj in self.obj_list: |
|
140 | 140 | # check permission at this level |
|
141 | name = getattr(db_obj, self.obj_attr, None) | |
|
141 | # NOTE(marcink): the __dict__.get() is ~4x faster then getattr() | |
|
142 | name = db_obj.__dict__.get(self.obj_attr, None) | |
|
142 | 143 | if not self.perm_checker(name, self.__class__.__name__, **self.extra_kwargs): |
|
143 | 144 | continue |
|
144 | 145 | |
@@ -153,7 +154,7 b' class RepoList(_PermCheckIterator):' | |||
|
153 | 154 | |
|
154 | 155 | super(RepoList, self).__init__( |
|
155 | 156 | obj_list=db_repo_list, |
|
156 | obj_attr='repo_name', perm_set=perm_set, | |
|
157 | obj_attr='_repo_name', perm_set=perm_set, | |
|
157 | 158 | perm_checker=HasRepoPermissionAny, |
|
158 | 159 | extra_kwargs=extra_kwargs) |
|
159 | 160 | |
@@ -166,7 +167,7 b' class RepoGroupList(_PermCheckIterator):' | |||
|
166 | 167 | |
|
167 | 168 | super(RepoGroupList, self).__init__( |
|
168 | 169 | obj_list=db_repo_group_list, |
|
169 | obj_attr='group_name', perm_set=perm_set, | |
|
170 | obj_attr='_group_name', perm_set=perm_set, | |
|
170 | 171 | perm_checker=HasRepoGroupPermissionAny, |
|
171 | 172 | extra_kwargs=extra_kwargs) |
|
172 | 173 |
General Comments 0
You need to be logged in to leave comments.
Login now