Ticket #960 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Support non-ascii character in internal error messages

Reported by: rgrp Owned by: pudo
Priority: critical Milestone: ckan-v1.4-sprint-1
Component: ckan Keywords:
Cc: Repository:
Theme:

Description

Just saw an error like the following which looks like it is to do with having a user object with non-ascii characters in it. Either get rid of 'cast' to str type here or do it in a unicode aware way.

Should do this not just here but everywhere we can find in the code base.

Module ckan.controllers.package:302 in edit
<<          am_authz = self.authorizer.am_authorized(c, model.Action.EDIT, pkg)
               if not am_authz:
                   abort(401, str(gettext('User %r not authorized to edit %s') % (c.user, id)))
       
               auth_for_change_state = self.authorizer.am_authorized(c, model.Action.CHANGE_STATE, pkg)
>>  abort(401, str(gettext('User %r not authorized to edit %s') % (c.user, id)))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

Estimate

Cost: 1h

Change History

comment:1 Changed 3 years ago by pudo

Test this with a dedicated test using a unicode user name.

comment:2 Changed 3 years ago by pudo

  • Status changed from new to closed
  • Resolution set to fixed

fixed in cset:8cb94dcdecb2

Note: See TracTickets for help on using tickets.