Hey there,<br><br>I am trying to create a module with one class<br>the module name is group.py<br><br>it looks like this so far<br><br>import DbConnector<br><br>class Group(object):<br><br> def __init__(self, id):<br>
<a href="http://self.id">self.id</a> = id<br> con = DbConnector.DbConnector()<br> query = con.getOne("select `name`, `position` from `groups` where `id` = '"+id+"' ")<br> <a href="http://self.name">
self.name</a> = query[0]<br> self.position = query[1]<br><br> def set_position(position):<br> self.position = position<br> con.update("update `groups` set `position` = '"+self.position+"' where `id` = '"+self.id"' ")
<br><br>now lets say i wanted to do <br>mygroup = Group.group(12)<br>position = mygroup.position() # gives me position of group where id = 12<br>mygroup.set_position(13) # changes value of position to 13<br><br>is this right?
<br>i would test it here, but the database is not available. I am writing this to implement an easier way to code something very long later.<br><br>Just wanted to know if i am on the right track.<br><br>if you have read this far, thanks !
<br><br>sk<br><br><br><br><br><br>