Log message for revision 71342: * don't barf if we try to load the localsite hook for the same class more than once
Changed: U Products.Five/branches/1.5/site/metaconfigure.py -=- Modified: Products.Five/branches/1.5/site/metaconfigure.py =================================================================== --- Products.Five/branches/1.5/site/metaconfigure.py 2006-11-30 21:48:16 UTC (rev 71341) +++ Products.Five/branches/1.5/site/metaconfigure.py 2006-11-30 22:18:48 UTC (rev 71342) @@ -40,7 +40,12 @@ "See Five/doc/localsite.txt .", DeprecationWarning, _context.info.file, _context.info.line) - if site_class is not None: + + # only install the hook once + already = getattr(class_, '_localsite_marker', False) + + if site_class is not None and not already: + class_._localsite_marker = True _context.action( discriminator = (class_,), callable = classSiteHook, @@ -61,6 +66,8 @@ delattr(class_, 'getSiteManager') delattr(class_, 'setSiteManager') classImplementsOnly(class_, implementedBy(class_)-IPossibleSite) + if getattr(class_, '_localsite_marker', False): + delattr(class_, '_localsite_marker') from zope.testing.cleanup import addCleanUp addCleanUp(uninstallSiteHooks) _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins