Hi Lucas,

On 01.07.2014 [18:30:17 -0300], Lucas Meneghel Rodrigues wrote:
> 
> 
> On 07/01/2014 04:41 PM, Nishanth Aravamudan wrote:
> >Hi Lucas,
> >
> >With a conmux setup, we get:
> >
> >conmux directory set to: <autotest.client.shared.base_job.job_directory
> >object at 0x1001b746290>
> >
> >I think that's because client/shared/base_job.py::job_directory doesn't
> >have the representation methods?
> 
> Yes, that's right. We should add one.

Not being a Python expert, __repr__ should be a unique string, right?
What would that be for job_directory? Looking through the various
existing files, it seems like it's not always, so maybe the following is
sufficient? If not, I'm happy to revise with some guidance.

Thanks,
Nish

With the current code and a conmux setup, we get:

conmux directory set to: <autotest.client.shared.base_job.job_directory
object at 0x1001b746290>

because there is no __repr__ or __str__ method. Provide the former
directly as the underlying path.

Signed-off-by: Nishanth Aravamudan <[email protected]>

diff --git a/client/shared/base_job.py b/client/shared/base_job.py
index 03d499b..e24fec4 100644
--- a/client/shared/base_job.py
+++ b/client/shared/base_job.py
@@ -63,6 +63,10 @@ class job_directory(object):
         self._ensure_valid(is_writable)
 
 
+    def __repr__(self):
+        return '%s' % self.path
+
+
     def _ensure_valid(self, is_writable):
         """
         Ensure that this is a valid directory.

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to