Index: ../../opt/sem/lib/python2.7/site-packages/suds/xsd/schema.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- ../../opt/sem/lib/python2.7/site-packages/suds/xsd/schema.py	(revision )
+++ ../../opt/sem/lib/python2.7/site-packages/suds/xsd/schema.py	(revision )
@@ -37,6 +37,9 @@
 
 log = getLogger(__name__)
 
+PROCESSED_IMPORTS_CACHE = {}
+PROCESSED_IMPORT_DEPTH = {}
+MAX_IMPORT_DEPTH = 3
 
 class SchemaCollection:
     """
@@ -394,7 +397,26 @@
         @rtype: L{Schema}
         @note: This is only used by Import children.
         """
-        return Schema(root, baseurl, options)
+
+        global PROCESSED_IMPORTS_CACHE, PROCESSED_IMPORT_DEPTH, MAX_IMPORT_DEPTH
+        if not baseurl in PROCESSED_IMPORTS_CACHE:
+            if baseurl in PROCESSED_IMPORT_DEPTH:
+                if (PROCESSED_IMPORT_DEPTH[baseurl] < MAX_IMPORT_DEPTH):
+                    PROCESSED_IMPORT_DEPTH[baseurl]+=1
+                    log.debug('Increasing import count for: %s' % baseurl)
+                else:
+                    log.debug('Maxdepth (%d) reached; Skipping processed import: %s' % (MAX_IMPORT_DEPTH, baseurl))
+                    return None
+            else:
+                PROCESSED_IMPORT_DEPTH[baseurl] = 1
+                log.debug('Importing for the first time: %s' % baseurl)
+
+            PROCESSED_IMPORTS_CACHE[baseurl] = Schema(root, baseurl, options)
+            log.debug('Successfully cached import: %s' % baseurl)
+        else:
+            log.debug('Retrieving import from cache: %s' % baseurl)
+
+        return PROCESSED_IMPORTS_CACHE[baseurl]
 
     def str(self, indent=0):
         tab = '%*s'%(indent*3, '')

