Code

Opened 2 years ago

Closed 2 years ago

#18075 closed Bug (invalid)

LOCALE_PATHS needs "," at the end of the locations

Reported by: esevece Owned by: nobody
Component: Translations Version: master
Severity: Normal Keywords:
Cc: esevece 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

Attachments (0)

Change History (6)

comment:1 Changed 2 years ago by esevece

  • Cc esevece added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 2 years ago by claudep

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

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 Changed 2 years ago by esevece

Ok. Sorry.
Thank you!

comment:4 Changed 2 years ago by anonymous

  • Resolution invalid deleted
  • Status changed from closed to reopened

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 Changed 2 years ago by FunkyBob

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 Changed 2 years ago by ramiro

  • Resolution set to invalid
  • Status changed from reopened to closed

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 2 years ago by ramiro (previous) (diff)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.