opental-checkins
[Top][All Lists]
Advanced

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

[OpenTAL-checkins] opental/PlacelessTranslationService __init__.py


From: Fernando Lalo Martins
Subject: [OpenTAL-checkins] opental/PlacelessTranslationService __init__.py
Date: Mon, 29 Sep 2003 12:30:19 -0400

CVSROOT:        /cvsroot/opental
Module name:    opental
Branch:         
Changes by:     Fernando Lalo Martins <address@hidden>  03/09/29 12:30:18

Modified files:
        PlacelessTranslationService: __init__.py 

Log message:
        getting rid of variables I do not need anymore

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

Patches:
Index: opental/PlacelessTranslationService/__init__.py
diff -u opental/PlacelessTranslationService/__init__.py:1.18 
opental/PlacelessTranslationService/__init__.py:1.19
--- opental/PlacelessTranslationService/__init__.py:1.18        Mon Sep 29 
10:49:12 2003
+++ opental/PlacelessTranslationService/__init__.py     Mon Sep 29 12:30:16 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.18 2003/09/29 14:49:12 lalo Exp $
+$Id: __init__.py,v 1.19 2003/09/29 16:30:16 lalo Exp $
 '''.strip()
 
 from OFS.Application import get_products
@@ -74,34 +74,36 @@
     translation_service = PlacelessTranslationService('default')
     translation_service.id = cp_id
     cp._setObject(cp_id, translation_service)
+    return getattr(cp, cp_id)
 
 def initialize(context):
     # hook into the Control Panel
     cp = context._ProductContext__app.Control_Panel # argh
-    if cp_id not in cp.objectIds():
-        make_translation_service(cp)
+    if cp_id in cp.objectIds():
+        cp_ts = getattr(cp, cp_id)
+    else:
+        cp_ts = make_translation_service(cp)
 
     # don't touch - this is the last version that didn't have the attribute 
(0.4)
-    instance_version = getattr(translation_service, '_instance_version', (0, 
4, 0, 0))
+    instance_version = getattr(cp_ts, '_instance_version', (0, 4, 0, 0))
     if instance_version < PlacelessTranslationService._class_version:
         log('outdated translation service found, recreating',
             detail = '(found %s.%s.%s.%s)\n' % instance_version)
         cp._delObject(cp_id)
-        make_translation_service(cp)
-    ts_unwrapped = translation_service.aq_base
+        cp_ts = make_translation_service(cp)
 
     # sweep products
     log('products: %r' % get_products(), zLOG.BLATHER)
     for prod in get_products():
         # prod is a tuple in the form:
         #(priority, dir_name, index, base_dir) for each Product directory
-        ts_unwrapped._load_dir(os.path.join(prod[3], prod[1], 'i18n'))
+        cp_ts._load_dir(os.path.join(prod[3], prod[1], 'i18n'))
 
     # sweep the i18n directory for local catalogs
-    ts_unwrapped._load_dir(os.path.join(INSTANCE_HOME, 'i18n'))
+    cp_ts._load_dir(os.path.join(INSTANCE_HOME, 'i18n'))
 
     # didn't found any catalogs
-    if not ts_unwrapped.objectIds():
+    if not cp_ts.objectIds():
         log('no translations found!', zLOG.PROBLEM)
 
     # notify anyone who needs it




reply via email to

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