Mailinglist Archive: yast-devel (77 mails)

< Previous Next >
Re: [yast-devel] Re: [yast-commit] <rest-service> backgroud_patches_bnc550934 : patches and status - moved the shared background code
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Wed, 16 Dec 2009 09:46:25 +0100
  • Message-id: <200912160946.25974.jreidinger@xxxxxxx>
Josef Reidinger write:
you don't provide to_json method which could be problem if we switch frontend
to json.
There you can benefit from serialization module which I write for BaseModel.
So instead of whole to_xml method you can get same result (and as bonus also
to_json and from_xml and from_json method) if you use this code:
(attr_serialized is needed to avoid callback instance serialization)

include BaseModel::Serialization
attr_serialized :status, :progress, :subprogress

There also problematic value. You as default use subprogress = nil (in
constructor) ...but when you serialize, you use subprogress.to_i, which is for
default value 0. So you cannot after deserialization recognize if subprogress
is nil or 0.

Note - all code is code from head, so no guaranty that it works out of box,
but it should work with little fixes.


Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >