CVS: Products/Basket - TODO.txt:1.3 __init__.py:1.20 utils.py:1.23

Chris McDonough <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Update of /cvs-repository/Products/Basket
In directory cvs.zope.org:/tmp/cvs-serv22999

Modified Files:
	TODO.txt __init__.py utils.py 
Log Message:
Minor code cleanups.


=== Products/Basket/TODO.txt 1.2 => 1.3 ===
--- Products/Basket/TODO.txt:1.2	Wed Nov  9 19:00:40 2005
+++ Products/Basket/TODO.txt	Wed Nov  9 19:40:46 2005
@@ -10,3 +10,5 @@
 - Tracebacks from egg products don't include code from inside the egg.
   Investigate this more (check if this is a known bug).
 
+- Figure out what to do about products with the same name while
+  iterating over their entry points.


=== Products/Basket/__init__.py 1.19 => 1.20 ===
--- Products/Basket/__init__.py:1.19	Wed Nov  9 19:31:11 2005
+++ Products/Basket/__init__.py	Wed Nov  9 19:40:46 2005
@@ -78,7 +78,6 @@
             initializer = get_initializer(point, productname, debug_mode)
             context = EggProductContext(productname, initializer, app,
                                         product_pkg, eggname)
-            # XXX debug mode conditions raise_exc, log_exc
             returned = context.install(debug_mode)
             data.append(returned)
         return data


=== Products/Basket/utils.py 1.22 => 1.23 ===
--- Products/Basket/utils.py:1.22	Wed Nov  9 18:22:28 2005
+++ Products/Basket/utils.py	Wed Nov  9 19:40:46 2005
@@ -1,17 +1,12 @@
-import time
-import pkg_resources
 import os
-import re
 import sys
-import resource
+import pkg_resources
+import resource # needs to be up here to monkeypatch
 
 import Globals
 from Globals import package_home
 from Globals import InitializeClass
 from Globals import ImageResource
-from OFS.content_types import guess_content_type
-from App.Common import rfc1123_date
-from App.special_dtml import defaultBindings
 from OFS.misc_ import Misc_
 import OFS
 
@@ -77,8 +72,10 @@
         self.meta_types = {}
         
     def create_product_object(self):
-        # Create a persistent object in the ControlPanel.Products area
-        # representing a product packaged as an egg and set it as self.product
+        """
+        Create a persistent object in the ControlPanel.Products area
+        representing a product packaged as an egg and return it
+        """
         products = self.app.Control_Panel.Products
         fver = ''
 
@@ -286,8 +283,7 @@
                 setattr(ObjectManager, name + '__roles__', pr)
                 if aliased:
                     # Set the unaliased method name and its roles
-                    # to avoid security holes.  XXX: All "legacy"
-                    # methods need to be eliminated.
+                    # to avoid security holes.
                     setattr(ObjectManager, method.__name__, method)
                     setattr(ObjectManager, method.__name__+'__roles__', pr)
 
@@ -479,43 +475,3 @@
         pass
 
 
-def import_product(product_dir, productname, raise_exc=0, log_exc=1):
-    path_join=os.path.join
-    isdir=os.path.isdir
-    exists=os.path.exists
-    _st=type('')
-    global_dict=globals()
-    silly=('__doc__',)
-    modules=sys.modules
-    have_module=modules.has_key
-
-    try:
-        package_dir=path_join(product_dir, productname)
-        if not isdir(package_dir): return
-        if not exists(path_join(package_dir, '__init__.py')):
-            if not exists(path_join(package_dir, '__init__.pyc')):
-                if not exists(path_join(package_dir, '__init__.pyo')):
-                    return
-
-        pname="Products.%s" % productname
-        try:
-            product=__import__(pname, global_dict, global_dict, silly)
-            if hasattr(product, '__module_aliases__'):
-                for k, v in product.__module_aliases__:
-                    if not have_module(k):
-                        if type(v) is _st and have_module(v): v=modules[v]
-                        modules[k]=v
-        except:
-            exc = sys.exc_info()
-            if log_exc:
-                LOG('Zope', ERROR, 'Could not import %s' % pname,
-                    error=exc)
-            f=StringIO()
-            traceback.print_exc(100,f)
-            f=f.getvalue()
-            try: modules[pname].__import_error__=f
-            except: pass
-            if raise_exc:
-                raise exc[0], exc[1], exc[2]
-    finally:
-        exc = None

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.