Re: Python Question (with regards to Marvin)

2016-05-02 Thread Tutkowski, Mike
> wrote: >> >> I was just "concerned" that those who have their own Marvin tests that are >> not checked in might be broken if I don't keep the class method. >> ________ >> From: Will Stevens <williamstev...@gmail.com

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Tutkowski, Mike
ect from the applicable UUID and then invoke the method on > it). > > That being the case, I think we should just keep the class methods. > > From: Will Stevens <williamstev...@gmail.com> > Sent: Sunday, May 1, 2016 12:15 PM > To: dev@cloudstack.apa

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 <williamstev...@gmail.com> 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 pre

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Will Stevens
ed in might be broken if I don't keep the class method. > > From: Will Stevens <williamstev...@gmail.com> > Sent: Sunday, May 1, 2016 12:03 PM > To: dev@cloudstack.apache.org > Subject: Re: Python Question (with regards to Marvin) >

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Tutkowski, Mike
stack.apache.org Subject: Re: Python Question (with regards to Marvin) It will be easy to grep if there class methods, so we should start there. If not, then I agree that an instance method is probably the best way to go. On May 1, 2016 12:41 PM, "Tutkowski, Mike" <mike.tutkow...@netapp

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Will Stevens
__ > From: Tutkowski, Mike <mike.tutkow...@netapp.com> > 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?

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Tutkowski, Mike
). From: Tutkowski, Mike <mike.tutkow...@netapp.com> 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

Re: Python Question (with regards to Marvin)

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

Re: Python Question (with regards to Marvin)

2016-05-01 Thread Will Stevens
t; > 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: &

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Tutkowski, Mike
quot;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: Saturday, April 30, 201

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Tutkowski, Mike
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
n(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. > > From: Will Stevens <williamstev...@gmail.com> > Sent: Saturday

Re: Python Question (with regards to Marvin)

2016-04-30 Thread Tutkowski, Mike
suspected, I think this means we have a problem in base.py. From: Will Stevens <williamstev...@gmail.com> 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 phone so

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

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. > >

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

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"

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:

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

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