launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00464
[Merge] lp:~mwhudson/launchpad/disable-vostok-when-not-configured into lp:launchpad/devel
Michael Hudson has proposed merging lp:~mwhudson/launchpad/disable-vostok-when-not-configured into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#614062 vostok publication breaks everything if vostok is not configured
https://bugs.launchpad.net/bugs/614062
See the linked bug report, basically.
This uses the name in the publisher zcml directive to check if the factory should be registered. This works great for everything apart from shipit, so I special cased that.
Cheers,
mwh
--
https://code.launchpad.net/~mwhudson/launchpad/disable-vostok-when-not-configured/+merge/31901
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mwhudson/launchpad/disable-vostok-when-not-configured into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/webapp/metazcml.py'
--- lib/canonical/launchpad/webapp/metazcml.py 2010-07-22 02:44:32 +0000
+++ lib/canonical/launchpad/webapp/metazcml.py 2010-08-05 22:01:12 +0000
@@ -34,6 +34,7 @@
from z3c.ptcompat.zcml import page_directive as original_page
from z3c.ptcompat.zcml import pages_directive as original_pages
+from canonical.config import config
from canonical.launchpad.layers import FeedsLayer
from canonical.launchpad.webapp.interfaces import (
IApplicationMenu, IAuthorization, ICanonicalUrlData, IContextMenu,
@@ -655,10 +656,19 @@
def launchpadPublisher(_context, name, factory, methods=['*'],
- mimetypes=['*'], priority=None):
- # This overrides zope's definition of the <publisher> directive to supply
- # an arbitrary unique priority if none is explicitly supplied -- we don't
- # care about the priority in Launchpad but it needs to be unique.
+ mimetypes=['*'], priority=None, vhost_name=None):
+ # This overrides zope's definition of the <publisher> directive to
+ # supply an arbitrary unique priority if none is explicitly
+ # supplied -- we don't care about the priority in Launchpad but it
+ # needs to be unique -- and to do nothing if no hostname is
+ # configured for this publisher.
+
+ # shipit, uniquely, uses a different name in its <publisher>
+ # directives to the name of the section in the config.
+ if not name.startswith('shipit'):
+ section = getattr(config.vhost, name, None)
+ if section is None or section.hostname is None:
+ return
global _arbitrary_priority
if priority is None:
_arbitrary_priority += 1