##// END OF EJS Templates
events: cleanup code, pep8, better logging.
marcink -
r2920:c35ca856 default
parent child Browse files
Show More
@@ -32,6 +32,7 b' def trigger_user_permission_flush(event)'
32 32 automatic flush of permission caches, so the users affected receive new permissions
33 33 Right Away
34 34 """
35
35 36 affected_user_ids = set(event.user_ids)
36 37 for user_id in affected_user_ids:
37 38 cache_namespace_uid = 'cache_user_auth.{}'.format(user_id)
@@ -34,7 +34,7 b' def trigger(event, registry=None):'
34 34 # passing the registry as an argument to get rid of it.
35 35 registry = registry or get_current_registry()
36 36 registry.notify(event)
37 log.debug('event %s triggered using registry %s', event, registry)
37 log.debug('event %s triggered using registry %s', event.__class__, registry)
38 38
39 39 # Until we can work around the problem that VCS operations do not have a
40 40 # pyramid context to work with, we send the events to integrations directly
@@ -33,7 +33,7 b' from rhodecode import events'
33 33 from rhodecode.integrations.types.base import EEIntegration
34 34 from rhodecode.lib.caching_query import FromCache
35 35 from rhodecode.model import BaseModel
36 from rhodecode.model.db import Integration, Repository, RepoGroup
36 from rhodecode.model.db import Integration, Repository, RepoGroup, true, false
37 37 from rhodecode.integrations import integration_type_registry
38 38
39 39 log = logging.getLogger(__name__)
@@ -132,7 +132,7 b' class IntegrationModel(BaseModel):'
132 132 query = self.sa.query(Integration).filter(
133 133 and_(Integration.repo_id==None,
134 134 Integration.repo_group_id==None,
135 Integration.child_repos_only==True)
135 Integration.child_repos_only == true())
136 136 )
137 137 elif scope == 'all':
138 138 query = self.sa.query(Integration)
@@ -158,7 +158,7 b' class IntegrationModel(BaseModel):'
158 158 query = self.sa.query(
159 159 Integration
160 160 ).filter(
161 Integration.enabled==True
161 Integration.enabled == true()
162 162 )
163 163
164 164 global_integrations_filter = and_(
@@ -171,7 +171,7 b' class IntegrationModel(BaseModel):'
171 171 root_repos_integrations_filter = and_(
172 172 Integration.repo_id==None,
173 173 Integration.repo_group_id==None,
174 Integration.child_repos_only==True,
174 Integration.child_repos_only == true(),
175 175 )
176 176
177 177 clauses = [
@@ -188,7 +188,7 b' class IntegrationModel(BaseModel):'
188 188 clauses.append(
189 189 and_(
190 190 Integration.repo_group_id==event.repo.group.group_id,
191 Integration.child_repos_only==True
191 Integration.child_repos_only == true()
192 192 )
193 193 )
194 194 # repo group cascade to kids
@@ -198,11 +198,10 b' class IntegrationModel(BaseModel):'
198 198 [group.group_id for group in
199 199 event.repo.groups_with_parents]
200 200 ),
201 Integration.child_repos_only==False
201 Integration.child_repos_only == false()
202 202 )
203 203 )
204 204
205
206 205 if not event.repo.group: # root repo
207 206 clauses.append(root_repos_integrations_filter)
208 207
@@ -219,4 +218,4 b' class IntegrationModel(BaseModel):'
219 218 FromCache("sql_cache_short", "get_enabled_global_integrations"))
220 219
221 220 result = query.all()
222 return result No newline at end of file
221 return result
General Comments 0
You need to be logged in to leave comments. Login now