On 9/27/2010 1:22 PM Norman Khine said...

what is the correct way to ensure that {'industry': 'travel', 'name':
'other','value': MSG(u"Other")} is always added to the end of this
list after all the items have been sorted?

here is the code which returns this list:

   options.sort(key=itemgetter('name'))
   return options

So, to answer the question you ask above, you can do:

   options.sort(key=itemgetter('name'))
   options.append({'industry':'travel',
      'name':'other','value':MSG(u"Other")}
   return options

But I don't think that's the question you're looking to get answered.

I think you want "other" to be found only at the end and not elsewhere.

Then you might try excluding other from options allowing the above to append it to the end:

for index, row in enumerate(topics.get_rows()):
    if row[0] != 'other':
        options.append({'name': row[0], 'value': MSG(row[1])})

HTH,

Emile

                

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to