buxeasywork / django-rosetta

Automatically exported from code.google.com/p/django-rosetta
MIT License
0 stars 0 forks source link

po files not found when there's a two-letters named directory in the project's path #84

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. install your project in path which has a two-letters directory (ie : 
'/var/www/mysite/v2/myproject')
2. make sure you do have po files in the appropriate locations !-)
3. go to the rosetta admin page

What is the expected output? What do you see instead?

Expected output : list of po files
Effective result : "Nothing to translate" message.

What version of the product are you using? On what operating system?
rosetta 0.5.6, ubuntu linux 

Please provide any additional information below.

The problem is with the regexp defined in poutil.find_pos() (poutil.py line 
#54):
    x=re.compile(r'(\w+)/../\1')                                                                                                                          The '/../' part matches any 2 chars - not literal '/../'. It should obviously be escaped - at least it solved the problem here :

    rx=re.compile(r'(\w+)/\.\./\1')

Original issue reported on code.google.com by bruno.de...@gmail.com on 15 Sep 2010 at 10:11

Attachments:

GoogleCodeExporter commented 9 years ago
Hello, sorry for the delay, but care to test this with the latest trunk? I 
can't really reproduce

I'm testing a project in /Users/marco/Code/hacks/v2/v2/testproject and all the 
po files in the different locations show up as expected.

Original comment by mbonetti on 7 Feb 2011 at 3:32

GoogleCodeExporter commented 9 years ago
The issue will reproduce only if the path is somewhat like
    /home/sites/project/v2/project
i.e. there is same word around the two-letters directory.

Here is the better (IMO) patch which doesn't use regex at all, since there is 
os.path.normpath function to get rid of .. and . folders in the path.

Original comment by dmedvinsky on 11 Mar 2011 at 9:37

Attachments:

GoogleCodeExporter commented 9 years ago
Oh I see it now. Good catch to both of you, and thank you for the patch!

Fixed in r121.

Original comment by mbonetti on 11 Mar 2011 at 10:09