[Top][All Lists]
[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 10:49:13 -0400 |
CVSROOT: /cvsroot/opental
Module name: opental
Branch:
Changes by: Fernando Lalo Martins <address@hidden> 03/09/29 10:49:13
Modified files:
PlacelessTranslationService: __init__.py
Log message:
another attempt at avoiding persistence
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/opental/opental/PlacelessTranslationService/__init__.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
Patches:
Index: opental/PlacelessTranslationService/__init__.py
diff -u opental/PlacelessTranslationService/__init__.py:1.17
opental/PlacelessTranslationService/__init__.py:1.18
--- opental/PlacelessTranslationService/__init__.py:1.17 Fri Sep 26
12:36:51 2003
+++ opental/PlacelessTranslationService/__init__.py Mon Sep 29 10:49:12 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.17 2003/09/26 16:36:51 lalo Exp $
+$Id: __init__.py,v 1.18 2003/09/29 14:49:12 lalo Exp $
'''.strip()
from OFS.Application import get_products
@@ -50,6 +50,15 @@
Globals.ImageFile('www/GettextMessageCatalog.png', globals()),
}
+# this is the module-level translation service
+translation_service = PlacelessTranslationService('default')
+
+# set product-wide attrs for importing
+translate = translation_service.translate
+getLanguages = translation_service.getLanguages
+getLanguageName = translation_service.getLanguageName
+negotiate = translation_service.negotiate
+
# import permissions
security = ModuleSecurityInfo('Products.PlacelessTranslationService')
security.declarePublic('negotiate')
@@ -57,21 +66,20 @@
security.declarePublic('getLanguages')
security.declarePublic('getLanguageName')
+# set ZPT's translation service
+setGlobalTranslationService(translation_service)
+
def make_translation_service(cp):
- from Products import PlacelessTranslationService as pkg
- # default (gettext) translation service
+ # Control_Panel translation service
translation_service = PlacelessTranslationService('default')
translation_service.id = cp_id
cp._setObject(cp_id, translation_service)
def initialize(context):
- from Products import PlacelessTranslationService as pkg
-
# hook into the Control Panel
cp = context._ProductContext__app.Control_Panel # argh
if cp_id not in cp.objectIds():
make_translation_service(cp)
- pkg.translation_service = getattr(cp, cp_id)
# 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))
@@ -80,17 +88,7 @@
detail = '(found %s.%s.%s.%s)\n' % instance_version)
cp._delObject(cp_id)
make_translation_service(cp)
- pkg.translation_service = getattr(cp, cp_id)
ts_unwrapped = translation_service.aq_base
-
- # set ZPT's translation service
- setGlobalTranslationService(translation_service)
-
- # set product-wide attrs for importing
- pkg.translate = translation_service.translate
- pkg.getLanguages = translation_service.getLanguages
- pkg.getLanguageName = translation_service.getLanguageName
- pkg.negotiate = translation_service.negotiate
# sweep products
log('products: %r' % get_products(), zLOG.BLATHER)
- [OpenTAL-checkins] opental/PlacelessTranslationService __init__.py,
Fernando Lalo Martins <=