Show More
@@ -138,7 +138,8 b' class _PermCheckIterator(object):' | |||||
138 | def __iter__(self): |
|
138 | def __iter__(self): | |
139 | for db_obj in self.obj_list: |
|
139 | for db_obj in self.obj_list: | |
140 | # check permission at this level |
|
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 | if not self.perm_checker(name, self.__class__.__name__, **self.extra_kwargs): |
|
143 | if not self.perm_checker(name, self.__class__.__name__, **self.extra_kwargs): | |
143 | continue |
|
144 | continue | |
144 |
|
145 | |||
@@ -153,7 +154,7 b' class RepoList(_PermCheckIterator):' | |||||
153 |
|
154 | |||
154 | super(RepoList, self).__init__( |
|
155 | super(RepoList, self).__init__( | |
155 | obj_list=db_repo_list, |
|
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 | perm_checker=HasRepoPermissionAny, |
|
158 | perm_checker=HasRepoPermissionAny, | |
158 | extra_kwargs=extra_kwargs) |
|
159 | extra_kwargs=extra_kwargs) | |
159 |
|
160 | |||
@@ -166,7 +167,7 b' class RepoGroupList(_PermCheckIterator):' | |||||
166 |
|
167 | |||
167 | super(RepoGroupList, self).__init__( |
|
168 | super(RepoGroupList, self).__init__( | |
168 | obj_list=db_repo_group_list, |
|
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 | perm_checker=HasRepoGroupPermissionAny, |
|
171 | perm_checker=HasRepoGroupPermissionAny, | |
171 | extra_kwargs=extra_kwargs) |
|
172 | extra_kwargs=extra_kwargs) | |
172 |
|
173 |
General Comments 0
You need to be logged in to leave comments.
Login now