opental-checkins
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OpenTAL-checkins] opental/PlacelessTranslationService GettextMess...


From: Fernando Lalo Martins
Subject: [OpenTAL-checkins] opental/PlacelessTranslationService GettextMess...
Date: Wed, 26 Mar 2003 07:54:35 -0500

CVSROOT:        /cvsroot/opental
Module name:    opental
Changes by:     Fernando Lalo Martins <address@hidden>  03/03/26 07:54:35

Modified files:
        PlacelessTranslationService: GettextMessageCatalog.py 
                                     PlacelessTranslationService.py 
                                     __init__.py 

Log message:
        making reload unconditional - after all, how often does it happen? and 
while I'm at it, re-enabling some ZMI stuff I disabled but shouldn't.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/PlacelessTranslationService/GettextMessageCatalog.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/PlacelessTranslationService/PlacelessTranslationService.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/PlacelessTranslationService/__init__.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text

Patches:
Index: opental/PlacelessTranslationService/GettextMessageCatalog.py
diff -u opental/PlacelessTranslationService/GettextMessageCatalog.py:1.10 
opental/PlacelessTranslationService/GettextMessageCatalog.py:1.11
--- opental/PlacelessTranslationService/GettextMessageCatalog.py:1.10   Wed Mar 
26 07:38:39 2003
+++ opental/PlacelessTranslationService/GettextMessageCatalog.py        Wed Mar 
26 07:54:35 2003
@@ -17,7 +17,7 @@
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
 """A simple implementation of a Message Catalog. 
 
-$Id: GettextMessageCatalog.py,v 1.10 2003/03/26 12:38:39 lalo Exp $
+$Id: GettextMessageCatalog.py,v 1.11 2003/03/26 12:54:35 lalo Exp $
 """
 
 from gettext import GNUTranslations
@@ -102,13 +102,8 @@
 
     def reload(self, REQUEST=None):
         "Forcibly re-read the file"
-        old_domain = self._domain
-        old_language = self._language
         self.__translation_object = None
         self._prepareTranslations()
-        if self._domain != old_domain or self._language != old_language:
-            # trouble
-            self.aq_parent.catalogChanged(self, old_language, old_domain)
         log('reloading %s: %s' % (self.id, self.title))
         if hasattr(REQUEST, 'RESPONSE'):
             REQUEST.RESPONSE.redirect(self.absolute_url())
Index: opental/PlacelessTranslationService/PlacelessTranslationService.py
diff -u opental/PlacelessTranslationService/PlacelessTranslationService.py:1.17 
opental/PlacelessTranslationService/PlacelessTranslationService.py:1.18
--- opental/PlacelessTranslationService/PlacelessTranslationService.py:1.17     
Wed Mar 26 07:38:39 2003
+++ opental/PlacelessTranslationService/PlacelessTranslationService.py  Wed Mar 
26 07:54:35 2003
@@ -17,7 +17,7 @@
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
 """Placeless Translation Service for providing I18n to file-based code.
 
-$Id: PlacelessTranslationService.py,v 1.17 2003/03/26 12:38:39 lalo Exp $
+$Id: PlacelessTranslationService.py,v 1.18 2003/03/26 12:54:35 lalo Exp $
 """
 
 import sys, re, zLOG, Globals
@@ -88,24 +88,24 @@
             fallbacks = LANGUAGE_FALLBACKS
         self._fallbacks = fallbacks
 
-    # Disable some inappropriate operations
-    manage_addObject=None
-    manage_delObjects=None
-    manage_addProperty=None
-    manage_editProperties=None
-    manage_delProperties=None
-
     def _registerMessageCatalog(self, catalog):
         key = (catalog.getLanguage(), catalog.getDomain())
         self._catalogs.setdefault(key, []).append(catalog.getIdentifier())
         self._p_changed = 1
 
-    def catalogChanged(self, catalog, old_language, old_domain):
+    def _unregisterMessageCatalog(self, catalog):
+        for combo in self._catalogs.values():
+            try:
+                combo.remove(catalog.getIdentifier())
+            except ValueError:
+                pass
+        self._p_changed = 1
+
+    def reloadCatalog(self, catalog):
         # trigger an exception if we don't know anything about it
         self._getOb(catalog.id)
-        # unregister
-        self._catalogs[(old_language, 
old_domain)].remove(catalog.getIdentifier())
-        # re-register
+        self._unregisterMessageCatalog(catalog)
+        catalog.reload()
         self._registerMessageCatalog(catalog)
 
     def addCatalog(self, catalog):
Index: opental/PlacelessTranslationService/__init__.py
diff -u opental/PlacelessTranslationService/__init__.py:1.10 
opental/PlacelessTranslationService/__init__.py:1.11
--- opental/PlacelessTranslationService/__init__.py:1.10        Wed Mar 12 
20:22:41 2003
+++ opental/PlacelessTranslationService/__init__.py     Wed Mar 26 07:54:35 2003
@@ -16,7 +16,7 @@
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
 __version__ = '''
-$Id: __init__.py,v 1.10 2003/03/13 01:22:41 lalo Exp $
+$Id: __init__.py,v 1.11 2003/03/26 12:54:35 lalo Exp $
 '''.strip()
 
 from AccessControl import ModuleSecurityInfo, allow_module, allow_class, 
allow_type
@@ -104,7 +104,7 @@
                 if ob is _marker:
                     
translation_service.addCatalog(GettextMessageCatalog(os.path.join(basepath, 
name)))
                 else:
-                    ob.reload()
+                    translation_service.reloadCatalog(ob)
             except ValueError:
                 log('Message Catalog has no metadata', zLOG.PROBLEM, name, 
sys.exc_info())
             except:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]