@@ -64,15 +64,19 @@ """ Many imports can be made for a single import statement. This method help the management of this aspect. """ - def __call__(self, name, globals={}, locals={}, fromlist=[], level=-1): + def __call__(self, name, globals=None, locals=None, + fromlist=None, level=-1): """ The import method itself. """ - return _STANDARD_PYTHON_IMPORTER(name, globals, locals, fromlist, + return _STANDARD_PYTHON_IMPORTER(name, + globals, + locals, + fromlist, level) def end(self): """ Needed for clean up. @@ -95,16 +99,21 @@ self._tl._modules_loaded = None def begin(self): self._tl._modules_loaded = set() - def __call__(self, name, globals={}, locals={}, fromlist=[], level=-1): + def __call__(self, name, globals=None, locals=None, + fromlist=None, level=-1): """ The import method itself. """ - call_begin_end = self._tl._modules_loaded == None + globals = globals or {} + locals = locals or {} + fromlist = fromlist or [] + + call_begin_end = self._tl._modules_loaded is None if call_begin_end: self.begin() try: self._tl.globals = globals @@ -240,15 +249,20 @@ if file_path.startswith(self.__web2py_path_os_path_sep): file_path = file_path[self.__web2py_path_os_path_sep_len:] return self.__RE_APP_DIR.match(file_path) return False - def __call__(self, name, globals={}, locals={}, fromlist=[], level=-1): + def __call__(self, name, globals=None, locals=None, + fromlist=None, level=-1): """ The import method itself. """ + globals = globals or {} + locals = locals or {} + fromlist = fromlist or [] + self.begin() #try: # if not relative and not from applications: if not name.startswith(".") and level <= 0 \ and not name.startswith("applications.") \ @@ -306,6 +320,8 @@ class _Web2pyDateTrackerImporter(_Web2pyImporter, _DateTrackerImporter): """ Like _Web2pyImporter but using a _DateTrackerImporter. """ + +