# HG changeset patch # User Goffi # Date 1456761171 -3600 # Node ID afc7f6328394c006f76d4bf5f8286941afc40d0c # Parent ac2ac7fe8a9bd63bde8bf4e7f85272319a7c2f04 jp (base): use need_connect attribue to detect if connection is needed instead of self.args.profile, as profile argument can be used by any command even if use_profile is False diff -r ac2ac7fe8a9b -r afc7f6328394 frontends/src/jp/base.py --- a/frontends/src/jp/base.py Mon Feb 29 16:13:47 2016 +0100 +++ b/frontends/src/jp/base.py Mon Feb 29 16:52:51 2016 +0100 @@ -427,6 +427,9 @@ parents.add(self.host.parents['profile' if need_connect else 'profile_session']) else: assert need_connect is None + self.need_connect = need_connect + # from this point, self.need_connect is None if connection is not needed at all + # False if session starting is needed, and True if full connection is needed if use_progress: parents.add(self.host.parents['progress']) @@ -580,14 +583,8 @@ cls(self) def run(self): - try: - if self.args.profile: - connect_profile = self.host.connect_profile - except AttributeError: - # the command doesn't need to connect profile - pass - else: - connect_profile(self.connected) + if self.need_connect is not None: + self.host.connect_profile(self.connected) try: show_progress = self.args.progress