[Tutor] iteration is overwriting the previous set value

Jonas Melian jonasmg at SoftHome.net
Thu Oct 20 01:16:13 CEST 2005


def _pre_save(self):
    for field in [self.name, self.native_name]:
        if not field.istitle():
            #print field.title()
            field = field.title()

The change I try to do there (field = field.title()) is not being applied
I changed code so that you do 'self.foo = bar' statements for each 
attribute instead of using a loop and see if data gets saved, and it goes ok

I'm supposed that each iteration is overwriting the previous set value

how solve it? using a dict?


More information about the Tutor mailing list