Mailinglist Archive: yast-devel (77 mails)

< Previous Next >
[yast-devel] Webyast: ancestor for models in rest-service merged to master
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Mon, 14 Dec 2009 16:45:28 +0100
  • Message-id: <200912141645.28738.jreidinger@xxxxxxx>
Hi,
I implement ancestor which have some usable utilities for rest-service models.
Reason to have it is in bug http://bugzilla.novell.com/show_bug.cgi?id=543423
.
I call it BaseModel and it is inspired by ActiveModel from rails3.0. It is
general usability and I think that all models which is not based on database
or REST service could benefit from it. ( just inform me, I can help you to use
it in your project).
Main features is:
* callbacks (before_save etc.)
* validations ( validates_format_of etc.)
* serialization ( to_xml and to_json and also restore it)
* mass assignment (load instance from hash, also whitelisting and blacklisting
attributes for mass assignment).
For details see documentation:
http://yast.suse.de:3334/view/webyast/job/webyast-service-head-
i586/javadoc/webservice/index.html classes in BaseModel namespace (sorry
internal only, as we still doesn't have public place where we synchronize
documentation ). Or you can generate it in git by rake doc:app in webservice
directory.
For example usage see time plugin, which use validations, after_save hook,
mass assignment and also serialization ( It is also example of xml limitation
as for hash is key used as tags and tags is quite restricted, so time module
must transform hash before serialization ).

Welcome your comments, suggestions or ideas what could be improved or added (
especially if more then one plugin could benefit from it).
Josef
--
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast
(language,time,basesystem,ntp)
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages