[z3-checkins] r18581 - in z3/Five/branch/regebro-sitemanager: .
browser
regebro at codespeak.net
regebro at codespeak.net
Fri Oct 14 18:54:28 CEST 2005
Author: regebro
Date: Fri Oct 14 18:54:25 2005
New Revision: 18581
Modified:
z3/Five/branch/regebro-sitemanager/browser/metaconfigure.py
z3/Five/branch/regebro-sitemanager/configure.zcml
z3/Five/branch/regebro-sitemanager/fiveconfigure.py
z3/Five/branch/regebro-sitemanager/fivedirectives.py
z3/Five/branch/regebro-sitemanager/localsite.py
z3/Five/branch/regebro-sitemanager/localsite.zcml
Log:
Doing some changes towards having a UI to switch the site on and off.
Modified: z3/Five/branch/regebro-sitemanager/browser/metaconfigure.py
==============================================================================
--- z3/Five/branch/regebro-sitemanager/browser/metaconfigure.py (original)
+++ z3/Five/branch/regebro-sitemanager/browser/metaconfigure.py Fri Oct 14 18:54:25 2005
@@ -51,11 +51,6 @@
attribute='__call__', menu=None, title=None,
):
- try:
- s = getGlobalService(Presentation)
- except ComponentLookupError, err:
- pass
-
_handle_menu(_context, menu, title, [for_], name, permission)
if not (class_ or template):
Modified: z3/Five/branch/regebro-sitemanager/configure.zcml
==============================================================================
--- z3/Five/branch/regebro-sitemanager/configure.zcml (original)
+++ z3/Five/branch/regebro-sitemanager/configure.zcml Fri Oct 14 18:54:25 2005
@@ -6,10 +6,11 @@
<include file="interfaces.zcml" />
<include file="permissions.zcml" />
<include file="i18n.zcml" />
- <include file="localsite.zcml" />
<include package=".browser" />
<include package=".form" />
<include package=".skin" />
+ # Localsite registers a page, and must come after browser.
+ <include file="localsite.zcml" />
<include package="zope.app.event" />
<include package="zope.app.traversing" />
Modified: z3/Five/branch/regebro-sitemanager/fiveconfigure.py
==============================================================================
--- z3/Five/branch/regebro-sitemanager/fiveconfigure.py (original)
+++ z3/Five/branch/regebro-sitemanager/fiveconfigure.py Fri Oct 14 18:54:25 2005
@@ -269,9 +269,9 @@
args=(class_, site_class)
)
_context.action(
- discriminator = (class_, ISite),
+ discriminator = (class_, IPossibleSite),
callable = classImplements,
- args=(class_, ISite)
+ args=(class_, IPossibleSite)
)
if utility_service is None:
utility_service = SimpleLocalUtilityService
@@ -328,7 +328,7 @@
def uinstallSiteHook(class_):
delattr(class_, 'getSiteManager')
delattr(class_, 'setSiteManager')
- classImplementsOnly(class_, implementedBy(class_)-ISite)
+ classImplementsOnly(class_, implementedBy(class_)-IPossibleSite)
_localsite_monkies.remove(class_)
def cleanUp():
Modified: z3/Five/branch/regebro-sitemanager/fivedirectives.py
==============================================================================
--- z3/Five/branch/regebro-sitemanager/fivedirectives.py (original)
+++ z3/Five/branch/regebro-sitemanager/fivedirectives.py Fri Oct 14 18:54:25 2005
@@ -120,3 +120,7 @@
title=u"Site Class",
required=False
)
+ utility_service = GlobalObject(
+ title=u"Utility Service Class",
+ required=False
+ )
\ No newline at end of file
Modified: z3/Five/branch/regebro-sitemanager/localsite.py
==============================================================================
--- z3/Five/branch/regebro-sitemanager/localsite.py (original)
+++ z3/Five/branch/regebro-sitemanager/localsite.py Fri Oct 14 18:54:25 2005
@@ -73,7 +73,7 @@
# We want the original object, not stuff in between, and no acquisition
obj = aq_base(obj)
if not ISite.providedBy(obj):
- raise TypeError, 'Must provide IPossibleSite'
+ raise TypeError, 'Must provide ISite'
rules = unregisterBeforeTraverse(obj, HOOK_NAME)
if hasattr(obj, HOOK_NAME):
delattr(obj, HOOK_NAME)
@@ -187,4 +187,20 @@
return LocalService(self)
def setSiteManager(self, sm):
- return
+ raise NotImplementedError('This class has a fixed site manager')
+
+
+from Products.Five.browser import BrowserView
+
+class MakeSite(BrowserView):
+ """View for convering a possible site to a site
+ """
+
+ def makeSite(self):
+ """Convert a possible site to a site"""
+ if ISite.providedBy(self.context):
+ raise ValueError('This is already a site')
+
+ enableLocalSiteHook(self.context)
+ return "This object is now a site"
+
\ No newline at end of file
Modified: z3/Five/branch/regebro-sitemanager/localsite.zcml
==============================================================================
--- z3/Five/branch/regebro-sitemanager/localsite.zcml (original)
+++ z3/Five/branch/regebro-sitemanager/localsite.zcml Fri Oct 14 18:54:25 2005
@@ -1,4 +1,5 @@
-<configure xmlns="http://namespaces.zope.org/zope">
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser">
<!-- enough to bootstrap the machinery to lookup local services -->
<include package="zope.configuration" file="meta.zcml" />
@@ -30,4 +31,12 @@
for="zope.app.publication.interfaces.IEndRequestEvent"
/>
+ <browser:page
+ for="zope.app.site.interfaces.IPossibleSite"
+ name="addServiceManager.html"
+ permission="zope2.Public"
+ class=".localsite.MakeSite"
+ attribute="makeSite"
+ />
+
</configure>
More information about the z3-checkins
mailing list