def update(self):
    ms = mysql_conn.Mysql()
    field_list = []
    field_list_value = []
    primary_key_value = None
    for (k, v) in self.mappings.items():
        if v.primary_key:
            primary_key_value = getattr(self, v.name, None)
        else:
            field_list.append((v.name + '=?'))
            field_list_value.append(getattr(self, v.name, v.default))
    sql = ('update %s set %s where %s = %s' % (self.table_name, ','.join(field_list), self.primary_key, primary_key_value))
    sql = sql.replace('?', '%s')
    ms.execute(sql, field_list_value)
def update(self):
    ms = mysql_conn.Mysql()
    field_list = []
    field_list_value = []
    primary_key_value = None
    for (k, v) in self.mappings.items():
        if v.primary_key:
            primary_key_value = getattr(self, v.name, None)
        else:
            field_list.append((v.name + '=?'))
            field_list_value.append(getattr(self, v.name, v.default))
    sql = ('update %s set %s where %s = %s' % (self.table_name, ','.join(field_list), self.primary_key, primary_key_value))
    sql = sql.replace('?', '%s')
    ms.execute(sql, field_list_value)