Hi,

there seem to be some few lines of code in pootle were paths are
not handled in a portable way. The attached patch fixes this.
I hope, I did not mix up file locations and URLs - please check before applying.

Additionally the file pagelayout.py contains a function 'makenavbarpath_dict'.
It seems to contain a mixture of file and URL handling. Thus I did not change
it. Maybe someone who knows this code could take a look? I had problems to get
into it, as comments were quite rare :)

regards,
Lars
Index: pootlefile.py
===================================================================
--- pootlefile.py	(Revision 5865)
+++ pootlefile.py	(Arbeitskopie)
@@ -655,7 +655,7 @@
     if path:
       return self.filename
     else:
-      return self.filename.split("/")[-1]
+      return os.path.basename(self.filename)
 
   def getext(self):
     """Returns the extension of the pootlefile"""
Index: indexpage.py
===================================================================
--- indexpage.py	(Revision 5865)
+++ indexpage.py	(Arbeitskopie)
@@ -310,7 +310,7 @@
       dirfilter = None
     self.dirfilter = dirfilter
     if dirfilter and dirfilter.endswith(".po"):
-      self.dirname = "/".join(dirfilter.split("/")[:-1])
+      self.dirname = os.path.dirname(dirfilter)
     else:
       self.dirname = dirfilter or ""
     self.argdict = argdict
@@ -612,7 +612,7 @@
     goalchildren = {}
     allchildren = []
     for childname in self.project.browsefiles(dirfilter=dirfilter, depth=depth, includedirs=True, includefiles=False):
-      allchildren.append(childname+"/")
+      allchildren.append(childname + os.path.sep)
     for childname in self.project.browsefiles(dirfilter=dirfilter, depth=depth, includedirs=False, includefiles=True):
       allchildren.append(childname)
     initial = dirfilter
@@ -890,12 +890,12 @@
       actionlinks.append(translatelink)
     if "zip" in linksrequired and "archive" in self.rights:
       if filepath and filepath.endswith(".po"):
-        currentfolder = "/".join(filepath.split("/")[:-1])
+        currentfolder = os.path.dirname(filepath)
       else:
         currentfolder = filepath
       archivename = "%s-%s" % (self.project.projectcode, self.project.languagecode)
       if currentfolder:
-        archivename += "-%s" % currentfolder.replace("/", "-")
+        archivename += "-%s" % currentfolder.replace(os.path.sep, "-")
       if goal:
         archivename += "-%s" % goal
       archivename += ".zip"
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Translate-pootle mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/translate-pootle

Reply via email to