Opened 17 years ago

Closed 15 years ago

#6380 closed (fixed)

make-messages.py don't follow symlinks

Reported by: Adrian <aribao@…> Owned by: nobody
Component: Internationalization Version: dev
Severity: Keywords: make-messages symlinks follow symbolic links
Cc: aribao@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I have created a repository with my apps, and when I need one for one of my projects, I link the code from the repository to the project path. This give me a problem.
When I want to use make-messages to extract all the translation strings, it doesn't follow this symbolic links.
I have patched make-messages.py to be able to extract the strings from the applications linked to the project.
I hope it helps.

Attachments (1)

make-messages.py.diff (1.0 KB ) - added by Adrian <aribao@…> 17 years ago.
Patch to allow make-messages.py follow symbolic links

Download all attachments as: .zip

Change History (6)

by Adrian <aribao@…>, 17 years ago

Attachment: make-messages.py.diff added

Patch to allow make-messages.py follow symbolic links

comment:1 by Simon Greenhill <dev@…>, 17 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:2 by aribao@…, 17 years ago

I'd like to make some improvements in this patch, what should I do? Something missing?
Thank you.

comment:3 by Malcolm Tredinnick, 17 years ago

If you want to upload a new patch, just do so. We'll only ever worry about the last patch.

There are a few improvements needed here, though:

  1. It doesn't need a nested function like this. Just declare a top-level function. It's much easier to read because there's no confusion about which code belongs to which function.
  2. Needs to be formatted as per PEP 8. In particular, no spaces after parentheses and spaces after commas.
  3. You seem to be going to a lot of effort to reinvent the behaviour of os.walk here. Why not just continue to use os.walk() to descend the directories and use the tip in the Python docs for os.walk for handling symlinks? That would require less extra code, I suspect, plus will use the already debugged os.walk() function instead of having to reinvent our own version.

comment:4 by Ramiro Morales, 15 years ago

The followlinks parameter of os.walk() was added in Python 2.6.

comment:5 by Jannis Leidel, 15 years ago

Resolution: fixed
Status: newclosed

(In [12443]) Fixed #6380 - Follow symlinks when examining source code and templates for translation strings.

Note: See TracTickets for help on using tickets.
Back to Top