strange behavior, really really strange! I gues monthy

python is coming from death to just kidding me!
This commit is contained in:
Rafael.Timmerberg 2013-06-19 02:45:37 +02:00
commit 3b6a3a55da
2 changed files with 12 additions and 3 deletions

View file

@ -1,4 +1,6 @@
from os.path import isfile from os.path import isfile
from os.path import join
from os import getcwd
import json import json
import sys import sys
import imp import imp
@ -109,7 +111,8 @@ class ConfigParser:
return mods["class"] return mods["class"]
else: else:
mod = __import__(clazz) mod = __import__(clazz)
#path = join("lib", modPart, clazz + ".py") #path = join(getcwd(), "lib", modPart, clazz + ".py")
#self.log.w(path)
#mod = imp.load_source(clazz, path) #mod = imp.load_source(clazz, path)
mods[clazz] = mod mods[clazz] = mod
return mod return mod
@ -128,6 +131,12 @@ class ConfigParser:
items = items_func(obj) items = items_func(obj)
for clazzItem in items: for clazzItem in items:
try: try:
if "class" not in clazzItem:
self.log.w("python says class is not in class item!")
self.log.w(modPart)
self.log.w(clazzItem)
self.log.w(clazzItem["class"])
clazz = clazzItem["class"] clazz = clazzItem["class"]
path = "lib/" + modPart path = "lib/" + modPart
sys.path.append(path) sys.path.append(path)
@ -145,7 +154,7 @@ class ConfigParser:
self.log.w("could not import " + clazz + ": " + str(clazzItem) + "! reason") self.log.w("could not import " + clazz + ": " + str(clazzItem) + "! reason")
self.log.w(str(err)) self.log.w(str(err))
except KeyError, k: except KeyError, k:
self.log.w("Key '" + str(k) + "' not in classItem " + str(clazzItem)) self.log.w("Key " + str(k) + " not in classItem " + str(clazzItem))
except Exception, e: except Exception, e:
self.log.w("Error while replacing class ( " + clazz + " ):" + str(e)) self.log.w("Error while replacing class ( " + clazz + " ):" + str(e))
finally: finally:

View file

@ -20,4 +20,4 @@ class XmppTask(Task):
def create(taskDict): def create(taskDict):
return XmppTask(taskDict) return XmppTask(**taskDict)