Alon Bar-Lev has uploaded a new change for review. Change subject: core: use single function for early debug ......................................................................
core: use single function for early debug Change-Id: I246b1602fa51bb005925b0dca0dc505849bc221f Signed-off-by: Alon Bar-Lev <alo...@redhat.com> --- M src/otopi/context.py 1 file changed, 13 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/90/13690/1 diff --git a/src/otopi/context.py b/src/otopi/context.py index e60cf77..7eee4f2 100644 --- a/src/otopi/context.py +++ b/src/otopi/context.py @@ -64,6 +64,10 @@ BaseEnv.PLUGIN_GROUPS -- plugin groups to load """ + def _earlyDebug(self, msg): + if self.environment[constants.BaseEnv.DEBUG] > 0: + print(msg) + def _loadPlugins(self, plugindir, needgroups): def _fulldir(d): return [os.path.join(d, f) for f in os.listdir(d)] @@ -81,17 +85,15 @@ for group in _fulldir(plugindir): if _candidate(group): groupname = os.path.basename(group) - if self.environment[constants.BaseEnv.DEBUG] > 0: - print('Loading plugin group %s' % groupname) + self._earlyDebug('Loading plugin group %s' % groupname) if groupname in needgroups: needgroups.remove(groupname) for p in _fulldir(group): if _candidate(p): - if self.environment[constants.BaseEnv.DEBUG] > 0: - print( - 'Loading plugin %s' % - os.path.basename(p) - ) + self._earlyDebug( + 'Loading plugin %s' % + os.path.basename(p) + ) util.loadModule( group, 'otopi.plugins.%s.%s' % ( @@ -296,12 +298,11 @@ candidateindex is not None and compare(candidateindex, index) ): - if self.environment[constants.BaseEnv.DEBUG] > 0: - print( - 'modifing method location %s' % ( - metadata['method'], - ) + self._earlyDebug( + 'modifing method location %s' % ( + metadata['method'], ) + ) l.insert(candidateindex+offset, metadata) if candidateindex < index: del l[index+1] -- To view, visit http://gerrit.ovirt.org/13690 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I246b1602fa51bb005925b0dca0dc505849bc221f Gerrit-PatchSet: 1 Gerrit-Project: otopi Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches