Opened 12 years ago

Closed 12 years ago

#18075 closed Bug (invalid)

LOCALE_PATHS needs "," at the end of the locations

Reported by: Stefano Vettorazzi Campos Owned by: nobody
Component: Translations Version: dev
Severity: Normal Keywords:
Cc: Stefano Vettorazzi Campos Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have wrote it in settings.py:

LOCALE_PATHS = (
    "/home/ubuntu/.../locale"
)

But translation didn't work.

Then I have wrote:

LOCALE_PATHS = (
    "/home/ubuntu/.../locale/",
)

And it works.

It took me one day for me to realize! HaHaHa

Change History (6)

comment:1 by Stefano Vettorazzi Campos, 12 years ago

Cc: Stefano Vettorazzi Campos added

comment:2 by Claude Paroz, 12 years ago

Resolution: invalid
Status: newclosed

The documentation tells clearly that it's a tuple.
https://docs.djangoproject.com/en/1.4/ref/settings/#locale-paths

Now it's about knowledge of Python syntax, a tuple containing only one element must end with a comma.

comment:3 by Stefano Vettorazzi Campos, 12 years ago

Ok. Sorry.
Thank you!

comment:4 by anonymous, 12 years ago

Resolution: invalid
Status: closedreopened

Django could easily check if passed element is atleast iterable to avoid such troubles (it also took an hour of debugging from me since django does not provide any information with locale paths is it using ATM).

comment:5 by FunkyBob, 12 years ago

As much as this is a fundamental Python syntax issue, the django devs have set a precedent in protecting users from this issue.

In the Settings class, there is the following:

    # Settings that should be converted into tuples if they're mistakenly entered
    # as strings.
    tuple_settings = ("INSTALLED_APPS", "TEMPLATE_DIRS")

comment:6 by Ramiro Morales, 12 years ago

Resolution: invalid
Status: reopenedclosed

I don't think we should be adapting the Django code to hand-holding users with basic Python concepts like these for every setting. IIRC I've read one core developer (In a ticket comment? in a mailing list post? in IRC?) regretting introduction of the feature FunkyBob points to (#88/r213): Automatic fixing of invalid setting values. See also: https://code.djangoproject.com/ticket/15094#comment:3

I'm closing this ticket for the reasons given above

Last edited 12 years ago by Ramiro Morales (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top