I have been working on NewChannelHelper, CreateChannelCommand,
ChannelSoftwareHandler and EditChannelAction.
Right now NewChannelHelper does some verifying and implements cloning,
while new channel creation is implemented in CreateChannelCommand.
Basic validation is in two places,
CreateChannelCommand validates and throws (translated) exceptions.
NewChannelHelper implements the logic (but only answers true or false)
and then the clone operation in the same class creates an untranslated
InvalidChannelParameter exception.
This makes sense, as NewChannelHelper::clone is used in
ChannelSoftwareHandler (xmlrpc) for the clonning, so an untranslated
error is ok (despite the duplication).
When I refactored the validation in one place, I kept the ones from
CreateChannelCommand, which are translated. I remember Tomas Lestach
mentioning in irc that it is important that these xmlrpc exceptions are
untranslated. Everything fine, however then I realized
ChannelSoftwareHandler uses CreateChannelCommand for creating channels,
and therefore it receives translated exceptions.
EditChannelAction catches the exceptions and based on the reason
constructs ActionMessages no matter if the exception was already
translated or not. If I could use the translated ones, I could remove
the switch per-reason and just construct an ActionMessage directly from
the Exception.
Any guidance here?
--
Duncan Mac-Vicar P. - http://www.suse.com/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix
Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany
_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel