===Origina function =====================
def addContext(self, name, dir):
if self._contexts.has_key(name):
print 'WARNING: Overwriting context %s (=%s) with %s' % (
repr(name), repr(self._contexts[name]), repr(dir))
__contextInitialized = 1 # Assume already initialized.
else:
__contextInitialized = 0
........
===Modified function ===================
def addContext(self, name, dir):
# Code added by Jose
# __init__ check file code
# this code will check for the __init__ file and add it if necessary
if not os.path.exists(os.path.join(dir, '__init__.py')):
# __init__.py file is missing creat it
print '__init__ file is missing, creating __init__ file now'
init = file(os.path.join(dir, '__init__.py'), 'w')
init.write('# Auto generated __init__ file\n')
init.close()
# end __init__ file check code
# end Code added by Jose
if self._contexts.has_key(name):
print 'WARNING: Overwriting context %s (=%s) with %s' % (
repr(name), repr(self._contexts[name]), repr(dir))
__contextInitialized = 1 # Assume already initialized.
else:
__contextInitialized = 0
..........
Then the requirment to have the __init__ file in the context goes away (mind you not realy, I only add it if it is not there).
Jose
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
-------- Original Message --------
Subject: [Webware-discuss] Why must a context be a module ?
From: "Lothar Scholz" <[EMAIL PROTECTED]>
Date: Sun, June 29, 2003 3:58 am
To: "webware-discuss" <[EMAIL PROTECTED]>
Hello,
Why do we have the requirement that a context directory must contain a
"__init__.py" file (otherwise the app server is not starting). I find
this a little bit annoying for newbies, without any real reasons.
I guess that the "__init__.py" is empty for most projects. And the
context directory should be in the PYTHON_PATH anyway, so this is also
no argument.
Best regards,
Lothar mailto:[EMAIL PROTECTED]
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss
