Python -- attributes inexplicably changing with nothing in between changing them? -


i can't figure out how happening, here's relevant code in class:

    def flip_states(self, newvalue):         ...         self.currentstate = newvalue         self.currenstatestr = genconfig.sensor_state_to_str[newvalue]         self.update_field_in_db("currentstate", self.currentstate)         self.update_field_in_db("currentstatestr", self.currenstatestr)         wx.callafter(dispatcher.send, eventconfig.element_state_listener,             orders=[self.gentype, self.currentstatestr, self.name, self.id]) 

simple enough, update_field_in_db calls gets newly reassigned version of self.currentstatestr, wx.callafter call gets old value of self.currentstatestr

when put print of currentstatestr value received db call, correct , db updates expected -- put print in function right after db calls before wx.callafter, were.

i thought maybe had how python assigned lists, can print attributes without list , still old ones. i've scoured db call make sure nothing else occurring change them. can see i'm going wrong?

edit 1:

update_field_in_db this:

def update_field_in_db(self, updatecol, updatetarget):         self.database.update_element(updatecol=updatecol, updatetarget=updatetarget, **self.dbargs) 

and database.update_element is:

def update_element(self, elementtype, updatecol, updatetarget, wherecol, wheretarget, updateall=false):         self.open_cursor()         if not updateall:             addquotes1 = "'" if type(updatetarget).__name__ == "str" else ""             addquotes2 = "'" if type(wheretarget).__name__ == "str" else ""             query = "update " + genconfig.db_tables[elementtype] + " set {0} = {add1}{1}{add1} {2} = {add2}{3}{add2}"             self.execute_query(query.format(updatecol, updatetarget, wherecol, wheretarget, add1=addquotes1, add2=addquotes2))         else:             pass # not implemented yet         self.close_cursor() 

currentstatestr spelled without t in assignment , db call, spelled t in wx.callafter call.

just spelling error, tough see 1 -- eclipse highlighting same-named variables revealed it.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -