Hi Steve,
On Thursday 07 August 2014 12:00 PM, Stephen J. Turnbull wrote:
Rajeev S writes:
I feel that it will make the code cluttered. Since the CLI code is independent of the rest of mailman client, won't it be better to maintain the CLI code in a separate folder, as it is now?
Of course. I didn't explain myself well. What you have now is
mailman/ -+- client/ -+- _client.py +- docs/ +- tests/ +- cli/ -+- client.py +- core/ +- docs/ +- lib/ +- tests/
The above tree is wrong, this is the current directory structure
mailmanclient/ -+- _client.py +- docs/ +- tests/ +- cli/ -+- mmclient.py +- core/ +- docs/ +- lib/ +- tests/ +- client/
That is, the cli/ directory lives directly inside the mailmanclient directory.
I don't see where. In Filter, you have:
class Filter(): key = None value = None operator = None data_set = [] utils = Utils()
def __init__(self, key, value, operator, data): self.key = key self.value = value self.operator = operator self.data_set = data
So as soon as you instance a Filter, __init__() creates instance attributes which shadow the class attributes (except utils). I don't see any references to Filter.<attr> or to super(), so I don't see how you can be using the class attributes.
Now I get it! Will fix that.
Now that the connection part is managed by a single function (Utils.connect), I will move the connection checking part to that function.
OK.
The connection can be checked without using a database query by trying
to invoke the
client.system
, at a single place.