Permalink
Browse files

python 2.5 compatibility: changed .format to % and json import

  • Loading branch information...
1 parent cb39bf9 commit 7a9f54aeb72e26d8396ef6c36151cf6ede01f511 Michael Meisinger committed May 12, 2010
Showing with 19 additions and 9 deletions.
  1. +4 −0 README.txt
  2. +3 −3 ion/core/base_process.py
  3. +5 −2 ion/core/cc/interceptor.py
  4. +2 −2 ion/core/cc/modloader.py
  5. +1 −1 ion/core/supervisor.py
  6. +4 −1 ion/data/objstore.py
View
@@ -82,6 +82,10 @@ again (see above). Please review the branch logs for any cues.
Change log:
===========
+2010-05-10:
+- Based on entries in config files, service process modules are sought and
+ loaded in order to collect the service process declarations. This enables
+ a registration of services with versions and dependencies on startup
2010-05-06:
- Refactored the BaseProcess class.
- You can now do RPC directly from the process, via self.rpc_send without
@@ -91,10 +91,10 @@ def op_init(self, content, headers, msg):
self.procName = content.get('proc-name', __name__)
supId = content.get('sup-id', None)
self.procSupId = pu.get_process_id(supId)
- logging.info('op_init: proc-name={0}, sup-id={1}'.format(self.procName,supId))
+ logging.info('op_init: proc-name=%s, sup-id=%s' % (self.procName,supId))
yield defer.maybeDeferred(self.plc_init)
- logging.info('===== Process {0} INITIALIZED ====='.format(self.procName))
+ logging.info('===== Process %s INITIALIZED =====' % (self.procName))
yield self.reply(msg, 'inform_init', {'status':'OK'}, {})
self.procState = "INITIALIZED"
@@ -272,7 +272,7 @@ def build(self, spawnArgs=None):
time instantiate class.
"""
if not spawnArgs: spawnArgs = {}
- logging.info("ProtocolFactory.build(name={0},args={1!s})".format(self.name,spawnArgs))
+ logging.info("ProtocolFactory.build(name=%s,args=%s)" % (self.name,spawnArgs))
receiver = self.receiver(self.name)
instance = self.processClass(receiver, spawnArgs)
receiver.procinst = instance
@@ -8,8 +8,11 @@
import logging
import hashlib
-import json
-
+try:
+ import json
+except:
+ import simplejson as json
+
from magnet.container import InterceptorSystem, Interceptor
from carrot.backends.base import BaseMessage
from ion.core import ioninit
@@ -46,14 +46,14 @@ def load_modules(self, mods=None):
self._load_module(mod)
def _load_module(self, mod):
- #logging.info('Loading Module {0}'.format(mod))
+ #logging.info('Loading Module %s' % (mod))
try:
modo = pu.get_module(mod)
except StandardError, ie:
logging.error("Error importing module: "+str(mod))
def _load_package(self, pack, recurse=False):
- #logging.info('Loading Package {0}'.format(pack))
+ #logging.info('Loading Package %s' % (pack))
try:
packo = pu.get_module(pack)
ppath = packo.__path__
@@ -63,7 +63,7 @@ def spawnChild(self, supProc=None):
self.procModObj = proc_mod
# Spawn instance of a process
- logging.debug("spawn({0},args={1!s})".format(self.procModule,self.spawnArgs))
+ logging.debug("spawn(%s,args=%s)" % (self.procModule,self.spawnArgs))
proc_id = yield spawn(proc_mod, None, self.spawnArgs)
self.procId = proc_id
self.procState = 'SPAWNED'
@@ -8,7 +8,10 @@
"""
import hashlib
-import json
+try:
+ import json
+except:
+ import simplejson as json
import logging
from twisted.internet import defer

0 comments on commit 7a9f54a

Please sign in to comment.