purplecat: Hand Drawn picture of a Toy Cat (programming)
purplecat ([personal profile] purplecat) wrote in [site community profile] dw_dev_training2013-10-27 08:52 am

Difference between icon selection when posting and when editing a post

A while back I tackled a bug in which icons could not have "0" as a keyword. The problems were all caused by the fact that perl treats "0" as false, so a lot of checks for the existence of a keyword on the icon were failing.

Having fixed that particular problem a host of others have been revealed when someone tries to use an icon with a 0 keyword and I've been working through these.

At present, in my dreamhack, it is possible to make a post with a 0-keyword-icon selected and view that post. However if you then try to edit the post the icon gets replaced by the default icon, and if, in the edit page, you attempt to select a 0 keyword icon, it doesn't get attached to the post in the database.

I'm tearing my hair out over this because I can not identify how icon selection differs in the edit form from the post form. The bug appears both using the new and old versions of the post form so I'm assuming it isn't in the javascript or template toolkit and I'm going cross-eyed grepping the codebase.

One of my problems is I'm not even entirely clear where may be a good point to start inserting some "warn" statements, or how to simulate post editing within the test suite.

Any hints, suggestions or pointers much appreciated.
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2013-10-28 05:02 am (UTC)(link)

How's it going? It might not be the default icon; that just gets shown as a fallback. Maybe we're not properly setting "selected" when the value is 0. (I suggest a lot of warns processlabel_and_value)

(Also just so you know: icons.size is standard / available in template toolkit because icons is a list. It doesn't need to be set anywhere)

denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2013-10-28 08:50 am (UTC)(link)

I think you might be the new "person with the greatest knack for picking a bug that seems simple until you dig into it a bit". :)

denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2013-10-28 10:35 am (UTC)(link)

You totally deserve cookies for this!

fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2013-10-29 01:08 am (UTC)(link)

Yes! Awesome!

fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2013-10-29 02:13 am (UTC)(link)

Awesome! Congrats!

fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2013-10-29 04:26 pm (UTC)(link)

I think usermsgreceived but I'm not sure off the top of my head! (Spelling might be off too)