[ckan-dev] DEVS PLEASE READ Re: Ckan Exceptions and translation

Toby Dacre toby.okfn at gmail.com
Mon Apr 22 08:58:14 UTC 2013


On 22 April 2013 09:41, Adrià Mercader <adria.mercader at okfn.org> wrote:

> What about messages from the authorization functions (eg
> logic/auth/create,update, etc) AFAICT most controllers and the action
> API just capture NotAuthorized and ignore the message from the auth
> function.
>

That feels wrong.  this does sound like something we should be checking.
We should probably do some work fixing this.

this from controllers/package.py looks correct so some places are working
at least.  Even if we are ignoring the actual reason.

         except NotAuthorized:
            abort(401, _('Unauthorized to read package %s') % id)




> Adrià
>
> On 20 April 2013 19:20, Vitor Baptista <vitor at vitorbaptista.com> wrote:
> > Hi Toby,
> >
> > Have you created an issue for this? It should be quite easy to grep and
> > remove all localized exception messages...
> >
> > Cheers,
> > Vítor Baptista.
> >
> >
> > 2013/4/18 Toby Dacre <toby.okfn at gmail.com>
> >>
> >> We agreed today that all Exceptions must be in English and _not_
> >> translated.
> >>
> >> this is because they are part of the code
> >> we all need to be able to read stack traces
> >> translators have enough to translate already
> >>
> >> Do not accept any pull requests that include them
> >> We also need to remove any we see in the code base
> >>
> >> If you have added any please remove them asap
> >>
> >> I will update the coding standards as soon as I can
> >>
> >> The API output should also be English only too.
> >>
> >> Thanks
> >>
> >> Toby
> >> On 17 April 2013 11:14, Adrià Mercader <adria.mercader at okfn.org> wrote:
> >>>
> >>> I'm generally +1 on not translating any exceptions, but as you say we
> >>> then need to make sure that they are captured by the controllers or
> >>> whatever before showing them on the frontend.
> >>>
> >>>
> >>> Adrià
> >>>
> >>> On 16 April 2013 15:17, Toby Dacre <toby.okfn at gmail.com> wrote:
> >>> > Hi,
> >>> >
> >>> > I see code like this
> >>> >     `raise Exception(_('some error'))`
> >>> >
> >>> > I think these should be
> >>> >     `raise Exception('some error')`
> >>> >
> >>> > In my view Exceptions are for developers and log files etc so we
> should
> >>> > not
> >>> > be pushing the Exception message to the user.  By using _ our error
> >>> > logs
> >>> > will be in the language of the user who had the error not in English
> >>> > like
> >>> > the code base.  This make support much more difficult.
> >>> >
> >>> > This is a new thing that has started happening.  Can anyone justify
> >>> > this
> >>> > change?  Can we stop doing it?
> >>> >
> >>> > Toby
> >>> >
> >>> > _______________________________________________
> >>> > ckan-dev mailing list
> >>> > ckan-dev at lists.okfn.org
> >>> > http://lists.okfn.org/mailman/listinfo/ckan-dev
> >>> > Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
> >>> >
> >>>
> >>> _______________________________________________
> >>> ckan-dev mailing list
> >>> ckan-dev at lists.okfn.org
> >>> http://lists.okfn.org/mailman/listinfo/ckan-dev
> >>> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
> >>
> >>
> >>
> >> _______________________________________________
> >> ckan-dev mailing list
> >> ckan-dev at lists.okfn.org
> >> http://lists.okfn.org/mailman/listinfo/ckan-dev
> >> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
> >>
> >
> >
> > _______________________________________________
> > ckan-dev mailing list
> > ckan-dev at lists.okfn.org
> > http://lists.okfn.org/mailman/listinfo/ckan-dev
> > Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
> >
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130422/38f3009c/attachment-0001.html>


More information about the ckan-dev mailing list