"Gert Cuykens" <[EMAIL PROTECTED]> escribió en el mensaje 
news:[EMAIL PROTECTED]

> class Db:
>
>    _db=-1
>    _cursor=-1
>
>    @classmethod
>    def __init__(self,server,user,password,database):
>        self._db=MySQLdb.connect(server , user , password , database)
>        self._cursor=self._db.cursor()
>
>    @classmethod
>    def excecute(self,cmd):
>        self._cursor.execute(cmd)
>        self._db.commit()
>
>
> if __name__ == '__main__':
>    gert=Db('localhost','root','******','gert')
>    gert.excecute('select * from person')
>    for x in range(0,gert.rowcount):
>        print gert.fetchone()
>    gert.close()

Besides your specific question that was already answered, why are you using 
classmethods at all?
You are constructing a Db instance and using it as if all were normal 
instance methods... Just remove all those @classmethod declarations and use 
it in a standard way.

-- 
Gabriel Genellina 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to