Rafal Zawadzki
bluszcz at jabberpl.org
Sat Nov 26 13:55:05 EST 2005
Dnia sobota 26 listopad 2005 19:45, napisałeś: > When the submitted form is being processed there is no way for it to > know how the form variables were created, whether by checkboxes, or > whatever. So unless it sees a particular named variable more than > once, there is no way to anticipate you want a list rather than a > single value. In my opinion this is not proper way. For example db api always returns list, even with single result. > Also there is a lot of prior tradition that this is how python HTML > form processors should work. For instance the standard cgi module > also does it this way. I don't like "tradition" like solutions. I like smart, proper way solutions. > What you can/should do instead is to just change it to a list in your > template if you want rather than patching mod_python. You can easily > write a helper function as so: > def force_as_list( v ): > if type(v) is not type([]): > return [v] > return v This is not python style, and it breaks duck typing. Check the types? Every time? It is not optimal. Please, give me better reasons than tradition. Best regards, -- __ __ Rafał Zawadzki [jid/mail: bluszcz at jabberpl.org, skype: blvszcz] | |--.| |.--.--.-----.-----.----.-----. [www: http://bluszcz.jabberpl.org] | _ || || | |__ --|-- __| __|-- __| [ http://pyrss.jabberstudio.org/ ] |_____||__||_____|_____|_____|____|_____| つた
|