# HG changeset patch # User Paul Boddie # Date 1342383020 -7200 # Node ID ceab20195fe53e6eee1ac1c58590ba475ccae351 # Parent 938ae4097683f432d02b3ed0bba5b964cb4b50ae Fixed error handling where no suitable content types are available. diff -r 938ae4097683 -r ceab20195fe5 actions/SharedUpdate.py --- a/actions/SharedUpdate.py Sun Jul 15 21:33:24 2012 +0200 +++ b/actions/SharedUpdate.py Sun Jul 15 22:10:20 2012 +0200 @@ -136,12 +136,14 @@ # Perform content negotiation if no mimetype was specified. if mimetype is None: - mimetype = getPreferredOutputTypes(request, mimetypes)[0] + mimetypes = getPreferredOutputTypes(request, mimetypes) + if mimetypes: + mimetype = mimetypes[0] # Where no suitable mimetype is found, break out of the loop and return # an error. - elif mimetype not in mimetypes: + if not mimetypes or mimetype not in mimetypes: status = "406 Not Acceptable" break