Author: chrisz
Date: Fri Jul 29 08:47:14 2011
New Revision: 8171
Log:
Avoid slash in module name since some Python versions do not like this.
Modified:
Webware/branches/Branch-1_0/WebKit/ServletFactory.py
Modified: Webware/branches/Branch-1_0/WebKit/ServletFactory.py
==============================================================================
--- Webware/branches/Branch-1_0/WebKit/ServletFactory.py Fri Jul 29 08:44:09 2011 (r8170)
+++ Webware/branches/Branch-1_0/WebKit/ServletFactory.py Fri Jul 29 08:47:14 2011 (r8171)
@@ -117,9 +117,10 @@
# There is no context, so import the module standalone
# and give it a unique name:
if not fullname or not path.startswith(contextPath):
- remainder = serverSidePathToImport
- fullmodname = remainder.replace(
- '\\', '_').replace('/', '_').replace('.', '_')
+ fullmodname = serverSidePathToImport
+ if os.sep != '/':
+ fullmodname = fullmodname.replace(os.sep, '_')
+ fullmodname = fullmodname.replace('/', '_').replace('.', '_')
if debug:
print __file__, ", fullmodname =", fullmodname
modname = os.path.splitext(os.path.basename(
@@ -130,14 +131,19 @@
module.__donotreload__ = True
return module
- # First, we'll import the context's package.
+ # First, we'll import the context's package.#
+ if os.sep != '/':
+ fullname = fullname.replace(os.sep, '_')
+ fullname = fullname.replace('/', '_'
directory, contextDirName = os.path.split(contextPath)
self._importModuleFromDirectory(fullname, contextDirName,
directory, isPackageDir=True)
directory = contextPath
# Now we'll break up the rest of the path into components.
- remainder = path[len(contextPath)+1:].replace('\\', '/')
+ remainder = path[len(contextPath)+1:]
+ if os.sep != '/':
+ remainder = remainder.replace(os.sep, '/')
remainder = remainder.split('/')
# Import all subpackages of the context package
|