Mailinglist Archive: yast-devel (126 mails)

< Previous Next >
Re: [yast-devel] [webYaST] :dasherize => false not enough to stop dasherizing? (bug 551284)
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Mon, 2 Nov 2009 16:21:29 +0100
  • Message-id: <200911021621.29563.jreidinger@xxxxxxx>
Jiří Suchomel write:
On Monday 02 of November 2009 13:23:26 Stefan Schubert wrote:
Klaus Kaempf schrieb:
* Jiří Suchomel <jsuchome@xxxxxxx> [Nov 02. 2009 09:17]:
Bug 551284 describes a problem of mail_settings plugin when it is
called for a second time (while first time it was during basesystem
sequence). The problem itself is that underscores are changed to
dashes in the POST call. And indeed, mail_settings_controller of the
webservice lacks the option to set dasherize to false in respond_to
function, so the solution looked easy.

37 160380ae3a8f078521 points to Hash.dasherize_xml which is set to
'true' by default.

Try setting it to 'false'.

SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)

I am also interested in "Hash.dasherize_xml" If it does work I would be
able to drop this work around from the registration model:

# Hash.from_xml converts dashes in keys to underscores
# by this we can not find out the correct key name (whether it was a
dash or an underscore)
# unfortunately the regcode keys in registration make excessive use of
dashes AND underscores
# that way the information gets lost what key to assign the correct
value. # So the function "unrename_keys" will be overwritten
module RailsHashFromWithoutConversationKey
Hash.class_eval do
def self.unrename_keys(params)
case params.class.to_s
when "Hash"
params.inject({}) do |h,(k,v)|
h[k.to_s] = unrename_keys(v)
when "Array" { |v| unrename_keys(v) }

What does this function actually do?
You have the problem because of converting dashesh to underscores, but my
problem is that underscores are changed to dashes.

As I mentioned earlier, the problem in mail_settings does not appear if I
remove registration step. Maybe just because of this code in registration
is the mail_settings broken.


I think you find root of problems. Because correct way is not to overwrite
behavior in class, but overwrite it in own instance.
So if registration need this hack, it should do:
xml =
def xml.unrename_keys(params)
...#your hack

of course you can write it much pretty e.g. pass xml instance and overwrite
method in separate code.

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

< Previous Next >
Follow Ups