[Stoq-devel] Re: [POS-commit] r3850 - stoqlib/trunk/stoqlib/domain
Henrique Romano
henrique at async.com.br
Tue Jul 4 10:30:32 BRT 2006
Johan Dahlin escreveu:
> Henrique Romano wrote:
>
>> Johan Dahlin escreveu:
>>
>>>> Modified: stoqlib/trunk/stoqlib/domain/service.py
>>>>
>>>>
>>>
>>>
>>>> + def _create(self, id, **kw):
>>>> + if 'status' not in kw:
>>>> + kw['status'] = AbstractSellable.STATUS_AVAILABLE
>>>> + AbstractSellable._create(self, id, **kw)
>>>>
>>>>
>>> This is not very nice code.
>>> Why cannot the default value in the column definition be used:
>>>
>>>
>>>
>> Because the column definition is in AbstractSellable and this
>> is in ServiceAdaptToSellable? For products, the default status
>> should be STATUS_SOLD, for service it doesn't makes sense
>> (see comment #2 of bug #2675).
>>
>
> Okay, that makes sense.
>
> Why cannot the normal python constructor be used:
>
> def __init__(self):
> AbstractSellable.__init__(self)
> self.status = AbstractSellable.STATUS_AVAILABLE
>
> ?
>
>
I don't know exactly why, but its being used in all Stoq and Stoqlib
since the begin. Last time I tested, I catch some SQLObject exceptions,
but currently I don't know if it is fixed. Should us lose more time with
time right now?
Henrique
More information about the Stoq-devel
mailing list