[Tutor] optimize code

Norman Khine norman at khine.net
Tue Dec 30 15:32:38 CET 2008


Hello,
I have this piece of code which I would like to further streamline it.

http://paste.lisp.org/display/72830

More specifically, I feel there is too many if statements.

What the code does is that it takes a form value and builds a dictionary

http://localhost/;search?level1=air-brokers-or-charters

returns

{'root_title': u'Expert Travel', 'here_title': 'Air brokers/air 
charter', 'country': 'UK'}

http://localhost/;search?level1=air-brokers-or-charters&level2=East+Anglia

returns

{'root_title': u'Expert Travel', 'level2': 'East Anglia', 'here_title': 
'Air brokers/air charter', 'country': 'UK'}


etc..

Thanks

Norman






More information about the Tutor mailing list