Re: Python Question (with regards to Marvin)

2016-05-02 Thread Tutkowski, Mike
licable UUID and then invoke the method on > it). > > That being the case, I think we should just keep the class methods. > > From: Will Stevens > Sent: Sunday, May 1, 2016 12:15 PM > To: dev@cloudstack.apache.org > Subject: Re:

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Tutkowski, Mike
oke the method on > it). > > That being the case, I think we should just keep the class methods. > > From: Will Stevens > Sent: Sunday, May 1, 2016 12:15 PM > To: dev@cloudstack.apache.org > Subject: Re: Python Question (with regard

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Tutkowski, Mike
on it). That being the case, I think we should just keep the class methods. From: Will Stevens Sent: Sunday, May 1, 2016 12:15 PM To: dev@cloudstack.apache.org Subject: Re: Python Question (with regards to Marvin) Ya. Let's see how prevalent the class me

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Will Stevens
f I don't keep the class method. > > From: Will Stevens > Sent: Sunday, May 1, 2016 12:03 PM > To: dev@cloudstack.apache.org > Subject: Re: Python Question (with regards to Marvin) > > It will be easy to grep if there class methods,

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Tutkowski, Mike
> From: Tutkowski, Mike > Sent: Sunday, May 1, 2016 10:18 AM > To: dev@cloudstack.apache.org > Subject: Re: Python Question (with regards to Marvin) > > The question then becomes, do we want to keep the instance or the class > method? > > There exists the same

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Will Stevens
e > Sent: Sunday, May 1, 2016 10:18 AM > To: dev@cloudstack.apache.org > Subject: Re: Python Question (with regards to Marvin) > > The question then becomes, do we want to keep the instance or the class > method? > > There exists the same problem for at least one other pai

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Tutkowski, Mike
ethod). From: Tutkowski, Mike Sent: Sunday, May 1, 2016 10:18 AM To: dev@cloudstack.apache.org Subject: Re: Python Question (with regards to Marvin) The question then becomes, do we want to keep the instance or the class method? There exists the same problem for at leas

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Tutkowski, Mike
: >>print "class hi" >> >> # test = Test() >> >> Test.run() >> >> What gets printed: >> class hi >> >> class Test: >> def run(self): >>print "instance hi" >> >>@classmethod >

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Will Stevens
What gets printed: > class hi > > class Test: > def run(self): > print "instance hi" > > @classmethod > def run(cls): > print "class hi" > > # test = Test() > > Test.run() > > What gets printed: > class hi >

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Tutkowski, Mike
ls): print "class hi" # test = Test() Test.run() What gets printed: class hi class Test: @classmethod def run(cls): print "class hi" # test = Test() Test.run() What gets printed: class hi ____ From: Tutkowski, Mike Sent: Sat

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Tutkowski, Mike
'class hi' >> 5 >> 6 def run(self): >> 7 print 'instance hi' >> 8 >> 9 test = Test() >> 10 >> 11 test.run() >> >> As I suspected, I think this means we have a problem in base.py. >> >

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Will Stevens
lf): > 7 print 'instance hi' > 8 > 9 test = Test() > 10 > 11 test.run() > > As I suspected, I think this means we have a problem in base.py. > ________________ > From: Will Stevens > Sent: Saturday, April 30, 2

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Tutkowski, Mike
Test() 10 11 test.run() As I suspected, I think this means we have a problem in base.py. From: Will Stevens Sent: Saturday, April 30, 2016 1:46 PM To: dev@cloudstack.apache.org Subject: Re: Python Question (with regards to Marvin) I am on my p

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Will Stevens
I am on my phone so I have not been able to research this for you. I think you are right for the most part. Instead of multiple methods, python kind of fakes overloading by being to have named function arguments which can have default values, so you can call the method with a dynamic number of arg

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Tutkowski, Mike
Will - You can override a method in Python, but can you overload it? http://stackoverflow.com/questions/10202938/how-do-i-use-method-overloading-in-python > On Apr 30, 2016, at 6:23 AM, Will Stevens wrote: > > Here is a pretty good explanation. > > http://stackoverflow.com/questions/136097/wha

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Tutkowski, Mike
Allow me to clarify. :-) host.enableMaintenance(apiclient) is how I was invoking it. Just like a regular instance method. For some reason, it wanted to invoke the class method when I did that and was complaining about the lack of a parameter. That being the case, I switched my code to the foll

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Will Stevens
You are probably getting this error because you are trying to call: Host.enableMaintenance(client) Check my examples above for how to call it. Sorry I am on my phone, so I am not very efficient with my phone and cant civet you better details. :) On Apr 30, 2016 8:23 AM, "Will Stevens" wrote: >

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Will Stevens
Here is a pretty good explanation. http://stackoverflow.com/questions/136097/what-is-the-difference-between-staticmethod-and-classmethod-in-python I am guessing that both exist because the function is called both with a host instance and with the class itself. Class instance example: `h.enableMa

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Prashanth Manthena
Hi Mike, classmethod's first argument is always its class as it is always bound to the class, which is not the case with normal methods. Thus, both of the above methods can in essence still co-exist in base.py as they serve different purposes. In the latter classmethod, you need to pass your host

Python Question (with regards to Marvin)

2016-04-29 Thread Tutkowski, Mike
Hi everyone, I received an error when trying to invoke the instance version of enableMaintenance (below). 'TypeError: enableMaintenance() takes exactly 3 arguments (2 given)\n'] I looked at base.py and it has the following with regards to maintenance mode for hosts: def enableMaintena