Hey folks,

I've just run up against a nasty little exception block in Application.py
which drops import errors on context initialization. I was trying to figure
out why some of my context's __init__.py code wasn't executing  - eventually
I simply tried to import the context from command line Python and saw an
ImportError related to a module I was importing as part of the
initialization.

So naturally I wondered why Webware didn't raise this ImportError on
AppServer startup, and this is what I found in Application.addContext():

799     try:
800         importAsName = name
801         localdir, pkgname = os.path.split(dir)
802         if not sys.modules.has_key(importAsName):
803             res = imp.find_module(pkgname, [localdir])
804             mod = imp.load_module(name, res[0], res[1], res[2])
805             if mod.__dict__.has_key('contextInitialize'):
806                 result = mod.__dict__['contextInitialize'](self,
os.path.normpath(os.path.join(os.getcwd(),dir)))
807                 if result != None and result.has_key('ContentLocation'):
808                     dir = result['ContentLocation']
809     except ImportError:
810         pass
811     print 'Loading context: %s at %s' % (name, dir)

So I have 2 questions:
1 - It would be nice to raise the ImportError. Is there a reason why it is
dropped?
2 - Shouldn't the 'Loading context ...' message come before the context load
is attempted? :)

Regards,
Ben



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to