[Stoq-devel] [Bug 2688] - Inconsistências no wizard de pedido de compra
bugzilla-daemon at async.com.br
bugzilla-daemon at async.com.br
Tue Sep 5 17:30:12 BRT 2006
http://bugs.async.com.br/show_bug.cgi?id=2688
--- Comment #33 from Johan Dahlin <jdahlin at async.com.br> 2006-09-05 17:30 BRT ---
(From update of attachment 3524)
>Index: stoqlib/gui/wizards/sellabletypewizard.py
>+from kiwi.python import Settable
>+class SelectionTypeStep(WizardEditorStep):
>+ (PRODUCT_EDITOR,
>+ SERVICE_EDITOR,) = range(2)
>+
>+ gladefile = 'SellableTypeStep'
>+ size = (300, 200)
>+ model_type = Settable
Can't you just use a simple/dummy subclass of Settable here to get some kind of
type safetly?
Eg:
class SelectionType(Settable):
pass
>Index: stoqlib/gui/editors/sellableeditor.py
>- storable = IStorable(self.model)
>- self.storable_proxy = self.add_proxy(storable,
>- SellableEditor.storable_widgets)
>+ if not isinstance(self.model, Service):
>+ storable = IStorable(self.model)
>+ self.storable_proxy = self.add_proxy(storable,
>+ SellableEditor.storable_widgets)
This is the wrong approach, avoid referencing a specific implementation
(Serivice), instead
catch errors when the model cannot be "casted" to IStorable" and avoid adding
that proxy to the
view:
storable = IStorable(self.model, None)
if storable is not None:
self.storable_proxy = self.add_proxy(storable,
SellableEditor.storable_widgets)
The rest looks good
More information about the Stoq-devel
mailing list