[Checkins] SVN: zope.site/trunk/ Set __parent__ and __name__ in the LocalSiteManager's constructor after calling constructor of its superclasses, so __name__ doesn't get overwritten with empty string by the Components constructor.
Dan Korostelev
nadako at gmail.com
Thu Aug 13 10:17:46 EDT 2009
Log message for revision 102737:
Set __parent__ and __name__ in the LocalSiteManager's constructor after calling constructor of its superclasses, so __name__ doesn't get overwritten with empty string by the Components constructor.
Don't set __parent__ and __name__ attributes of site manager in SiteManagerContainer's ``setSiteManager`` method, as they're already set for LocalSiteManager. Other site manager implementations are not required to have those attributes at all, so we're not adding them anymore.
Changed:
U zope.site/trunk/CHANGES.txt
U zope.site/trunk/src/zope/site/site.py
U zope.site/trunk/src/zope/site/site.txt
-=-
Modified: zope.site/trunk/CHANGES.txt
===================================================================
--- zope.site/trunk/CHANGES.txt 2009-08-13 13:50:59 UTC (rev 102736)
+++ zope.site/trunk/CHANGES.txt 2009-08-13 14:17:46 UTC (rev 102737)
@@ -5,9 +5,17 @@
3.6.4 (unreleased)
------------------
-- Nothing changed yet.
+- Set __parent__ and __name__ in the LocalSiteManager's constructor
+ after calling constructor of its superclasses, so __name__ doesn't
+ get overwritten with empty string by the Components constructor.
+- Don't set __parent__ and __name__ attributes of site manager in
+ SiteManagerContainer's ``setSiteManager`` method, as they're
+ already set for LocalSiteManager. Other site manager implementations
+ are not required to have those attributes at all, so we're not
+ adding them anymore.
+
3.6.3 (2009-07-27)
------------------
Modified: zope.site/trunk/src/zope/site/site.py
===================================================================
--- zope.site/trunk/src/zope/site/site.py 2009-08-13 13:50:59 UTC (rev 102736)
+++ zope.site/trunk/src/zope/site/site.py 2009-08-13 14:17:46 UTC (rev 102737)
@@ -81,8 +81,6 @@
if zope.component.interfaces.IComponentLookup.providedBy(sm):
self._sm = sm
- sm.__name__ = '++etc++site'
- sm.__parent__ = self
else:
raise ValueError('setSiteManager requires an IComponentLookup')
@@ -140,13 +138,14 @@
super(LocalSiteManager, self)._setBases(bases)
def __init__(self, site, default_folder=True):
+ BTreeContainer.__init__(self)
+ zope.component.persistentregistry.PersistentComponents.__init__(self)
+
# Locate the site manager
self.__parent__ = site
self.__name__ = '++etc++site'
- BTreeContainer.__init__(self)
- zope.component.persistentregistry.PersistentComponents.__init__(self)
-
+ # Set base site manager
next = _findNextSiteManager(site)
if next is None:
next = zope.component.getGlobalSiteManager()
Modified: zope.site/trunk/src/zope/site/site.txt
===================================================================
--- zope.site/trunk/src/zope/site/site.txt 2009-08-13 13:50:59 UTC (rev 102736)
+++ zope.site/trunk/src/zope/site/site.txt 2009-08-13 14:17:46 UTC (rev 102737)
@@ -123,6 +123,14 @@
>>> 'default' in nodefault
False
+Also, note that when creating LocalSiteManager, its __parent__ is set to
+site that was passed to constructor and the __name__ is set to ++etc++site.
+
+ >>> nodefault.__parent__ is myfolder
+ True
+ >>> nodefault.__name__ == '++etc++site'
+ True
+
You can easily create a new site management folder:
>>> sm['mySMF'] = site.SiteManagementFolder()
More information about the Checkins
mailing list