Colin Watson has proposed merging ~cjwatson/launchpad:zcml-namespaces-authorization into launchpad:master.
Commit message: Move ZCML authorizations directive to lp namespace Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/436831 While experimenting with https://github.com/collective/zpretty, I noticed that Launchpad installs a number of ZCML directives under the XML namespaces http://namespaces.zope.org/browser, http://namespaces.zope.org/mail, and http://namespaces.zope.org/zope. As well as feeling a bit rude, this also makes it difficult to integrate properly with auto-formatting tools such as `zpretty` that can benefit from being told about details of the preferred ordering of attributes for each tag. We have a perfectly good http://namespaces.canonical.com/lp XML namespace that we already use for a few ZCML directives, so I think it would make sense to move our other local directives to that. There'll be a bit of readjustment, but it should also have the benefit that it will be more obvious at a glance where to start looking for the definition of a given directive (this is something I've had difficulty with in the past). As an initial proof of concept, this commit moves the `authorizations` directive to http://namespaces.canonical.com/lp. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:zcml-namespaces-authorization into launchpad:master.
diff --git a/doc/how-to/security.rst b/doc/how-to/security.rst index bc18080..4bf7e2b 100644 --- a/doc/how-to/security.rst +++ b/doc/how-to/security.rst @@ -113,10 +113,14 @@ Note that "accessed" means ``getattr()``, while "modified" means to fetch the method from the object, so methods should be declared in ``interface`` or ``attributes`` even if they modify the object. -3. Ensure that there is an ``<authorizations />`` directive in the package's - top-level ``configure.zcml`` file that specifies the package's security - module. If it isn't there already, add one like: +3. Ensure that there is an ``<lp:authorizations />`` directive in the + package's top-level ``configure.zcml`` file that specifies the package's + security module. If it isn't there already, add one like: .. code-block:: xml - <authorizations module=".security" /> + <lp:authorizations module=".security" /> + +To make the ``lp:`` namespace prefix work, the ``<configure />`` tag at the +top of the file should include the attribute +``xmlns:lp="http://namespaces.canonical.com/lp"``. diff --git a/lib/lp/answers/configure.zcml b/lib/lp/answers/configure.zcml index 90d1679..d84083d 100644 --- a/lib/lp/answers/configure.zcml +++ b/lib/lp/answers/configure.zcml @@ -9,7 +9,7 @@ xmlns:lp="http://namespaces.canonical.com/lp" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include package=".browser" /> <publisher diff --git a/lib/lp/archivepublisher/configure.zcml b/lib/lp/archivepublisher/configure.zcml index 2ea8a71..2b386e7 100644 --- a/lib/lp/archivepublisher/configure.zcml +++ b/lib/lp/archivepublisher/configure.zcml @@ -6,11 +6,12 @@ xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:i18n="http://namespaces.zope.org/i18n" + xmlns:lp="http://namespaces.canonical.com/lp" xmlns:webservice="http://namespaces.canonical.com/webservice" xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <!-- ArchiveGPGSigningKey --> <class class="lp.archivepublisher.archivegpgsigningkey.ArchiveGPGSigningKey"> <allow interface="lp.archivepublisher.interfaces.archivegpgsigningkey.IArchiveGPGSigningKey"/> diff --git a/lib/lp/blueprints/configure.zcml b/lib/lp/blueprints/configure.zcml index 36b9af7..8b482eb 100644 --- a/lib/lp/blueprints/configure.zcml +++ b/lib/lp/blueprints/configure.zcml @@ -11,7 +11,7 @@ xmlns:lp="http://namespaces.canonical.com/lp" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include package=".browser"/> <include package=".vocabularies"/> diff --git a/lib/lp/bugs/configure.zcml b/lib/lp/bugs/configure.zcml index 6eaa58c..0ce6cba 100644 --- a/lib/lp/bugs/configure.zcml +++ b/lib/lp/bugs/configure.zcml @@ -11,7 +11,7 @@ xmlns:lp="http://namespaces.canonical.com/lp" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include file="vocabularies.zcml"/> <include package=".browser"/> diff --git a/lib/lp/buildmaster/configure.zcml b/lib/lp/buildmaster/configure.zcml index 4b35965..d8a80ce 100644 --- a/lib/lp/buildmaster/configure.zcml +++ b/lib/lp/buildmaster/configure.zcml @@ -6,12 +6,13 @@ xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:i18n="http://namespaces.zope.org/i18n" + xmlns:lp="http://namespaces.canonical.com/lp" xmlns:webservice="http://namespaces.canonical.com/webservice" xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" i18n_domain="launchpad"> <include package=".browser"/> <include file="vocabularies.zcml"/> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <!-- Processor --> <class diff --git a/lib/lp/charms/configure.zcml b/lib/lp/charms/configure.zcml index 74d490d..bb598ba 100644 --- a/lib/lp/charms/configure.zcml +++ b/lib/lp/charms/configure.zcml @@ -11,7 +11,7 @@ xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include package=".browser" /> <lp:help-folder folder="help" name="+help-charms" /> diff --git a/lib/lp/code/configure.zcml b/lib/lp/code/configure.zcml index b962de7..75afc36 100644 --- a/lib/lp/code/configure.zcml +++ b/lib/lp/code/configure.zcml @@ -12,7 +12,7 @@ i18n_domain="launchpad"> <include package=".browser"/> <include package=".vocabularies"/> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <publisher name="code" diff --git a/lib/lp/configure.zcml b/lib/lp/configure.zcml index b8467e3..ab2b4b0 100644 --- a/lib/lp/configure.zcml +++ b/lib/lp/configure.zcml @@ -4,10 +4,8 @@ <configure xmlns="http://namespaces.zope.org/zope" - xmlns:browser="http://namespaces.zope.org/browser" - xmlns:grok="http://namespaces.zope.org/grok" - xmlns:webservice="http://namespaces.canonical.com/webservice" xmlns:i18n="http://namespaces.zope.org/i18n" + xmlns:lp="http://namespaces.canonical.com/lp" i18n_domain="launchpad"> <includeOverrides @@ -41,7 +39,7 @@ <include file="permissions.zcml" /> - <authorizations module="lp.security" /> + <lp:authorizations module="lp.security" /> <!-- The default Zope 3 configuration of the SimpleComponentTraverser is that it applies to any object that provides Interface. diff --git a/lib/lp/oci/configure.zcml b/lib/lp/oci/configure.zcml index 098a26d..6ec946e 100644 --- a/lib/lp/oci/configure.zcml +++ b/lib/lp/oci/configure.zcml @@ -8,7 +8,7 @@ xmlns:webservice="http://namespaces.canonical.com/webservice" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include package=".browser" /> <include file="vocabularies.zcml" /> diff --git a/lib/lp/registry/configure.zcml b/lib/lp/registry/configure.zcml index 64cb8a2..534b883 100644 --- a/lib/lp/registry/configure.zcml +++ b/lib/lp/registry/configure.zcml @@ -11,7 +11,7 @@ xmlns:webservice="http://namespaces.canonical.com/webservice" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include file="vocabularies.zcml"/> <include diff --git a/lib/lp/services/auth/configure.zcml b/lib/lp/services/auth/configure.zcml index c50d89a..1ee8eb4 100644 --- a/lib/lp/services/auth/configure.zcml +++ b/lib/lp/services/auth/configure.zcml @@ -6,10 +6,11 @@ xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:i18n="http://namespaces.zope.org/i18n" + xmlns:lp="http://namespaces.canonical.com/lp" xmlns:webservice="http://namespaces.canonical.com/webservice" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <class class="lp.services.auth.model.AccessToken"> <require permission="launchpad.Edit" diff --git a/lib/lp/services/features/configure.zcml b/lib/lp/services/features/configure.zcml index 4d8f75a..bcd22cd 100644 --- a/lib/lp/services/features/configure.zcml +++ b/lib/lp/services/features/configure.zcml @@ -4,9 +4,9 @@ <configure xmlns="http://namespaces.zope.org/zope" - xmlns:browser="http://namespaces.zope.org/browser"> + xmlns:lp="http://namespaces.canonical.com/lp"> - <authorizations module=".security"/> + <lp:authorizations module=".security"/> <include package=".browser"/> diff --git a/lib/lp/services/identity/configure.zcml b/lib/lp/services/identity/configure.zcml index f58ace8..b99ccb4 100644 --- a/lib/lp/services/identity/configure.zcml +++ b/lib/lp/services/identity/configure.zcml @@ -2,11 +2,12 @@ xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:i18n="http://namespaces.zope.org/i18n" + xmlns:lp="http://namespaces.canonical.com/lp" xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" xmlns:webservice="http://namespaces.canonical.com/webservice" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <class class="lp.services.identity.model.emailaddress.EmailAddress"> <allow diff --git a/lib/lp/services/librarian/configure.zcml b/lib/lp/services/librarian/configure.zcml index 84f70d1..93a94d1 100644 --- a/lib/lp/services/librarian/configure.zcml +++ b/lib/lp/services/librarian/configure.zcml @@ -5,10 +5,10 @@ <configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" - xmlns:zope="http://namespaces.zope.org/zope" + xmlns:lp="http://namespaces.canonical.com/lp" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include file="client.zcml" /> <class class="lp.services.librarian.model.LibraryFileAlias"> diff --git a/lib/lp/services/messages/configure.zcml b/lib/lp/services/messages/configure.zcml index ab004f0..9feb624 100644 --- a/lib/lp/services/messages/configure.zcml +++ b/lib/lp/services/messages/configure.zcml @@ -6,10 +6,11 @@ xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:i18n="http://namespaces.zope.org/i18n" + xmlns:lp="http://namespaces.canonical.com/lp" xmlns:webservice="http://namespaces.canonical.com/webservice" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <!-- Message --> <class class="lp.services.messages.model.message.Message"> <allow diff --git a/lib/lp/services/oauth/configure.zcml b/lib/lp/services/oauth/configure.zcml index db02a1b..a857945 100644 --- a/lib/lp/services/oauth/configure.zcml +++ b/lib/lp/services/oauth/configure.zcml @@ -5,11 +5,10 @@ <configure xmlns="http://namespaces.zope.org/zope" xmlns:i18n="http://namespaces.zope.org/i18n" - xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" - xmlns:browser="http://namespaces.zope.org/browser" + xmlns:lp="http://namespaces.canonical.com/lp" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include package=".browser"/> <class class="lp.services.oauth.model.OAuthConsumer"> diff --git a/lib/lp/services/openid/configure.zcml b/lib/lp/services/openid/configure.zcml index fd31827..5517c05 100644 --- a/lib/lp/services/openid/configure.zcml +++ b/lib/lp/services/openid/configure.zcml @@ -4,11 +4,11 @@ <configure xmlns="http://namespaces.zope.org/zope" - xmlns:browser="http://namespaces.zope.org/browser" xmlns:i18n="http://namespaces.zope.org/i18n" + xmlns:lp="http://namespaces.canonical.com/lp" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <class class=".model.openididentifier.OpenIdIdentifier"> <require permission="launchpad.View" diff --git a/lib/lp/services/webapp/configure.zcml b/lib/lp/services/webapp/configure.zcml index 702afab..c47c31b 100644 --- a/lib/lp/services/webapp/configure.zcml +++ b/lib/lp/services/webapp/configure.zcml @@ -5,10 +5,11 @@ <configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" + xmlns:lp="http://namespaces.canonical.com/lp" xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include file="errorlog.zcml" /> <include file="database.zcml" /> diff --git a/lib/lp/services/webapp/meta.zcml b/lib/lp/services/webapp/meta.zcml index bc50bb8..e45ec73 100644 --- a/lib/lp/services/webapp/meta.zcml +++ b/lib/lp/services/webapp/meta.zcml @@ -70,7 +70,7 @@ </complexDirective> <directive - namespace="http://namespaces.zope.org/zope" + namespace="http://namespaces.canonical.com/lp" name="authorizations" schema="lp.services.webapp.metazcml.IAuthorizationsDirective" handler="lp.services.webapp.metazcml.authorizations" diff --git a/lib/lp/services/webhooks/configure.zcml b/lib/lp/services/webhooks/configure.zcml index 81530db..1982ed1 100644 --- a/lib/lp/services/webhooks/configure.zcml +++ b/lib/lp/services/webhooks/configure.zcml @@ -5,9 +5,10 @@ <configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" + xmlns:lp="http://namespaces.canonical.com/lp" xmlns:webservice="http://namespaces.canonical.com/webservice"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <class class="lp.services.webhooks.model.Webhook"> <require permission="launchpad.View" diff --git a/lib/lp/services/worlddata/configure.zcml b/lib/lp/services/worlddata/configure.zcml index 9747a19..05a196c 100644 --- a/lib/lp/services/worlddata/configure.zcml +++ b/lib/lp/services/worlddata/configure.zcml @@ -5,9 +5,10 @@ <configure xmlns="http://namespaces.zope.org/zope" xmlns:i18n="http://namespaces.zope.org/i18n" + xmlns:lp="http://namespaces.canonical.com/lp" xmlns:webservice="http://namespaces.canonical.com/webservice" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include file="vocabularies.zcml"/> <class class=".model.country.Country"> diff --git a/lib/lp/snappy/configure.zcml b/lib/lp/snappy/configure.zcml index 5f8081a..da9d6bc 100644 --- a/lib/lp/snappy/configure.zcml +++ b/lib/lp/snappy/configure.zcml @@ -4,14 +4,12 @@ <configure xmlns="http://namespaces.zope.org/zope" - xmlns:browser="http://namespaces.zope.org/browser" xmlns:i18n="http://namespaces.zope.org/i18n" xmlns:lp="http://namespaces.canonical.com/lp" xmlns:webservice="http://namespaces.canonical.com/webservice" - xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include package=".browser" /> <include file="vocabularies.zcml" /> diff --git a/lib/lp/soyuz/configure.zcml b/lib/lp/soyuz/configure.zcml index 0740ee5..0ea1e96 100644 --- a/lib/lp/soyuz/configure.zcml +++ b/lib/lp/soyuz/configure.zcml @@ -4,14 +4,12 @@ <configure xmlns="http://namespaces.zope.org/zope" - xmlns:browser="http://namespaces.zope.org/browser" xmlns:i18n="http://namespaces.zope.org/i18n" xmlns:lp="http://namespaces.canonical.com/lp" xmlns:webservice="http://namespaces.canonical.com/webservice" - xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include package=".browser"/> <include diff --git a/lib/lp/translations/configure.zcml b/lib/lp/translations/configure.zcml index 2ece7c1..ebe5c40 100644 --- a/lib/lp/translations/configure.zcml +++ b/lib/lp/translations/configure.zcml @@ -4,14 +4,12 @@ <configure xmlns="http://namespaces.zope.org/zope" - xmlns:browser="http://namespaces.zope.org/browser" xmlns:i18n="http://namespaces.zope.org/i18n" - xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc" - xmlns:webservice="http://namespaces.canonical.com/webservice" xmlns:lp="http://namespaces.canonical.com/lp" + xmlns:webservice="http://namespaces.canonical.com/webservice" i18n_domain="launchpad"> - <authorizations module=".security" /> + <lp:authorizations module=".security" /> <include package=".browser"/> <include file="vocabularies.zcml"/>
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : [email protected] Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp

