[Zope-Checkins] CVS: Zope/lib/python/App - Product.py:1.64

Fred L. Drake, Jr. fred@zope.com
Wed, 9 Jul 2003 14:45:11 -0400


Update of /cvs-repository/Zope/lib/python/App
In directory cvs.zope.org:/tmp/cvs-serv2303

Modified Files:
	Product.py 
Log Message:
- delay import of the rotor module; this avoids deprecation warnings
  when it isn't actually used (like in the unit tests...)


=== Zope/lib/python/App/Product.py 1.63 => 1.64 ===
--- Zope/lib/python/App/Product.py:1.63	Mon Jun  9 10:22:57 2003
+++ Zope/lib/python/App/Product.py	Wed Jul  9 14:45:05 2003
@@ -34,7 +34,7 @@
 #   on restart if there is still a product directory.
 
 
-import os, re, zlib, marshal, rotor, cPickle
+import os, re, zlib, marshal, cPickle
 from cgi import escape
 from urllib import quote
 
@@ -197,6 +197,7 @@
 
         id=self.id
 
+        import rotor
         import tar
         rot=rotor.newrotor(id+' shshsh')
         ar=tar.tgzarchive("%s-%s" % (id, self.version))
@@ -437,7 +438,9 @@
     def __init__(self, f, rot):
         self._c=zlib.decompressobj()
         self._b=''
-        if type(rot) is type(''): rot=rotor.newrotor(rot)
+        if isinstance(rot, str):
+            import rotor
+            rot=rotor.newrotor(rot)
         self._rot=rot
         rot.decrypt('')
         self._f=f