Hi,

First, a Debian package for 0.11 should be available really soon now.

I wanted to post a summary/status of the patches used in the Debian
package since a long time, but did not take the time to write it.
So here it is!

 * pootle_typos.patch
   It only fixes two small typos in the Python documentation.
   I'm attaching it to this mail.
   IMO, it can be applied.
 * debian_system_installation.patch
   Change the default paths for a system wide installation.
   I will probably keep it as a Debian specific patch
 * pootle_gnuprojects_no_detect.patch
   This provide a great speedup for large GNU style projects.
   IMO, it can be safely applied. It won't have any effect until an
   administrator adds a 'treestyle = gnu' property in the prefs file.
   It could be improved by providing a way to change/set this property
   with the WEB frontend.
 * pootle_logos_prefs.patch
   Permit a personalization of the Pootle logos (pootle, pootle-medium and
   banner) in the prefs file.
   For example: on http://i18n.debian.net:8080/projects/pootle/, you can
   see a Pootle with a swirl
 * pootle_get_pofiles_with_find.patch
   Speedup the listing of big projects by using find instead of the
   Python's os.path.walk. This should work when find is not available
   (i.e. on Windows), but it was not tested.
 * pootle_ll_CC_languages.patch
   This patch differentiate languages like pt and pt_BR in the stats.
   (IIRC, the pt_BR PO files were conted both in pt and pt_BR)
   Unfortunatelly, this patch is based on the
   pootle_get_pofiles_with_find.patch patch, so you will have to apply
   this one too if you want to apply it as is.
   But it can be easily changed to be applied on the SVN version.
   NOTE: I need to re-check if it is necessary, since the issue do not
   appears to be there on http://pootle.wordforge.org/projects/pootle/
 * pootle_continue_after_po_failure.patch
   It should not be necessary with the toolkit v0.11.
   I avoid pootle crashing when a Po is not valid (but the project with
   this PO file will not be usable). With toolkit 0.11, invalid PO files
   are not very frequent (IIRC, it was caused by PO files using UTF-8, or
   accentuated caracters not UTF-8 in the header)
 * pootle_mail_header.patch
   This fix the encoding of subjects of registration mails (IIRC, the
   problem occurred on a Russian registration mail).
   It could have been implemented in jToolkit, but the mailer would have
   to assume that it receives always UTF-8, or an argument should be
   added.
 * pootle_no_autoload.patch
   Speedup loading a project and lower the memory consumption of the
   PootleServer.
   When a project is loaded, only the quick stats file is loaded.
   This provides a great speedup, but it may be more dangerous than the
   other patches (It relies on the fact that the stats files and the PO
   files are synchronized - i.e. the PO files must always be updated with
   the web frontend, or the stats have to be regenerated by hand when the
   PO files are updated manually on the filesystem)
 * pootle_no_autoload_language.patch
   The goal of this patch is the same as the previous one, but for the
   language pages (i.e. pootle/lang/ or pootle/project/lang/).
   It is not activated on the Debian package (I did not work on it since a
   long time, I don't remember its status;)
   It is more complex, and thus more risky, but the goal is basically the
   same: only read the quick stats file if possible, otherwise fallback to
   the stats file (to display the checks results; depending on the
   options). I need to work a bit more on it, and test it.
   I'm also willing to disable some options depending on the number of PO
   files in a directory (e.g. you can only see the quick stats if there
   are more than 1000 PO files; you need to enter deeper in the hierarchy
   if you want to see the checks results)


You can find the patches in the Debian source package. If needed, I can
put them in a more accessible place.

I'm attaching the patches which I think could be worth being applied at
this time:
 * pootle_typos.patch
 * pootle_gnuprojects_no_detect.patch
 * pootle_logos_prefs.patch
 * pootle_mail_header.patch

I can provide some measurements for the speedups of
pootle_gnuprojects_no_detect.patch and pootle_no_autoload.patch if you
wish.

Kind Regards,
-- 
Nekral
Goal: minor typos

Index: trunk/Pootle/projects.py
===================================================================
--- trunk.orig/Pootle/projects.py	2007-04-14 14:36:58.000000000 +0200
+++ trunk/Pootle/projects.py	2007-04-14 14:38:47.000000000 +0200
@@ -61,7 +61,7 @@
     return True
 
 class potimecache(timecache.timecache):
-  """caches pootlefile objects, remembers time, and reverts back to statistics when neccessary..."""
+  """caches pootlefile objects, remembers time, and reverts back to statistics when necessary..."""
   def __init__(self, expiryperiod, project):
     """initialises the cache to keep objects for the given expiryperiod, and point back to the project"""
     timecache.timecache.__init__(self, expiryperiod)
@@ -1014,7 +1014,7 @@
               translatedwords, translated, fuzzywords, fuzzy, totalwords, total])
 
   def getquickstats(self, pofilenames=None):
-    """gets translated and total stats and wordcouts without doing calculations returning dictionary"""
+    """gets translated and total stats and wordcounts without doing calculations returning dictionary"""
     if pofilenames is None:
       pofilenames = self.pofilenames
     alltranslatedwords, alltranslated, allfuzzywords, allfuzzy, alltotalwords, alltotal = 0, 0, 0, 0, 0, 0
Goal: Force the style of a project in the configuration

To detect a GNU style project, all files need to be checked (only the
filename). This can takes a long time.

Also the current algorithm can fail automatically switch to a non GNU style
if it finds a 2 or 3 letter directory name (di, apt, vi, etc.).

Note:
GNU style projects are the ones organized like:
  project
   dir
    dir
     <lang1>.po
     <lang2>.po
     ...

While non GNU are organized this way:
  project
   <lang>
     <file1>.po
     <file2>.po
     ...

Index: trunk/Pootle/potree.py
===================================================================
--- trunk.orig/Pootle/potree.py	2007-04-14 14:38:36.000000000 +0200
+++ trunk/Pootle/potree.py	2007-04-14 14:38:40.000000000 +0200
@@ -356,6 +356,22 @@
 
   def hasgnufiles(self, podir, languagecode=None, depth=0, maxdepth=3, poext="po"):
     """returns whether this directory contains gnu-style PO filenames for the given language"""
+    try:
+      if (podir.startswith(self.podirectory)):
+        dirs = podir[len(self.podirectory):].split(os.sep)
+        if len(dirs[0]):
+          projectcode = dirs[0]
+        else:
+          projectcode = dirs[1]
+        projectprefs = getattr(self.projects, projectcode)
+        style = getattr(projectprefs, "treestyle")
+        if    style == "gnu"    \
+           or style == "nongnu":
+          return style
+        else:
+          print "Unsupported treestyle value (project %s): %s"%(projectcode,style)
+    except:
+      pass
     #Let's check to see if we specifically find the correct gnu file
     foundgnufile = False
     if not os.path.isdir(podir):
Goal: Permit a personalization of the Pootle logos.


Index: trunk/Pootle/pagelayout.py
===================================================================
--- trunk.orig/Pootle/pagelayout.py	2007-04-14 14:36:58.000000000 +0200
+++ trunk/Pootle/pagelayout.py	2007-04-14 14:38:44.000000000 +0200
@@ -19,16 +19,27 @@
 # along with translate; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-def layout_banner(maxheight):
+def layout_banner(maxheight, session):
   """calculates dimensions, image name for banner"""
   logo_width, logo_height = min((98*maxheight/130, maxheight), (98, 130))
   banner_width, banner_height = min((290*maxheight/160, maxheight), (290, 160))
   if logo_width <= 61:
-    logo_image = "pootle-medium.png"
+    try:
+      logo_image = getattr(session.instance.logos, "medium")
+    except:
+      logo_image = "/images/pootle-medium.png"
   else:
-    logo_image = "pootle.png"
+    try:
+      logo_image = getattr(session.instance.logos, "normal")
+    except:
+      logo_image = "/images/pootle.png"
+  try:
+    banner_image = getattr(session.instance.logos, "banner")
+  except:
+    banner_image = "/images/WordForge-white.png"
   return {"logo_width": logo_width, "logo_height": logo_height,
-    "banner_width": banner_width, "banner_height": banner_height, "logo_image": logo_image}
+    "banner_width": banner_width, "banner_height": banner_height,
+    "logo_image": logo_image, "banner_image": banner_image}
 
 def localize_links(session):
   """Localize all the generic links"""
@@ -76,7 +87,7 @@
     templatevars["baseurl"] = getattr(session.instance, "baseurl", "/")
     if not templatevars["baseurl"].endswith("/"):
     	templatevars["baseurl"] += "/"
-  banner_layout = layout_banner(bannerheight)
+  banner_layout = layout_banner(bannerheight, session)
   banner_layout["logo_alttext"] = session.localize("Pootle Logo")
   banner_layout["banner_alttext"] = session.localize("WordForge Translation Project")
   templatevars.update(banner_layout)
Index: trunk/Pootle/templates/pootlepage.html
===================================================================
--- trunk.orig/Pootle/templates/pootlepage.html	2007-04-14 14:36:58.000000000 +0200
+++ trunk/Pootle/templates/pootlepage.html	2007-04-14 14:38:44.000000000 +0200
@@ -15,7 +15,7 @@
     <table cellpadding="0" width="100%" border="0" cellspacing="0">
       <tr>
         <td rowspan="1" colspan="1" align="left" width="${logo_width}" valign="top">
-          <img src="${baseurl}images/${logo_image}" height="${logo_height}" width="${logo_width}" alt="${logo_alttext}" style="padding-top:5px;" />
+          <img src="${logo_image}" height="${logo_height}" width="${logo_width}" alt="${logo_alttext}" style="padding-top:5px;" />
         </td>
 
         <td colspan="1" rowspan="1" width="5">
@@ -26,7 +26,7 @@
           <table cellspacing="0" style="height: ${banner_height}px" width="100%" cellpadding="0" border="0" class="header">
             <tr>
               <td colspan="1" align="center" rowspan="1" valign="middle">
-                 <img src="${baseurl}images/WordForge-white.png" height="${banner_height}" width="${banner_width}" alt="${banner_alttext}" style="padding-top:5px;"/>
+                 <img src="${banner_image}" height="${banner_height}" alt="${banner_alttext}" style="padding-top:5px;"/>
               </td>
             </tr>
 
Goal: Encode the Subject Header of the registration mails in UTF-8.

Fixes: #395496

Index: trunk/Pootle/users.py
===================================================================
--- trunk.orig/Pootle/users.py	2007-04-14 14:36:59.000000000 +0200
+++ trunk/Pootle/users.py	2007-04-14 14:38:19.000000000 +0200
@@ -24,6 +24,7 @@
 from jToolkit import mailer
 from jToolkit import prefs
 from Pootle import pagelayout
+from email.Header import Header
 
 class RegistrationError(ValueError):
   def __init__(self, message):
@@ -412,7 +413,9 @@
     message += session.localize("Your registered email address is: %s\n", email)
     smtpserver = self.instance.registration.smtpserver
     fromaddress = self.instance.registration.fromaddress
-    messagedict = {"from": fromaddress, "to": [email], "subject": session.localize("Pootle Registration"), "body": message}
+    subject = Header(session.localize("Pootle Registration"),
+                     "utf-8").encode()
+    messagedict = {"from": fromaddress, "to": [email], "subject": subject, "body": message}
     if supportaddress:
       messagedict["reply-to"] = supportaddress
     fullmessage = mailer.makemessage(messagedict)
-------------------------------------------------------------------------
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