[Checkins] SVN: zope.principalregistry/trunk/src/zope/principalregistry/ Don't repeat directive namespace in each directive.
Dan Korostelev
nadako at gmail.com
Fri Mar 13 06:31:44 EDT 2009
Log message for revision 98027:
Don't repeat directive namespace in each directive.
Rip off any zope.publisher use.
Changed:
U zope.principalregistry/trunk/src/zope/principalregistry/meta.zcml
U zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principalregistry.py
-=-
Modified: zope.principalregistry/trunk/src/zope/principalregistry/meta.zcml
===================================================================
--- zope.principalregistry/trunk/src/zope/principalregistry/meta.zcml 2009-03-13 10:23:32 UTC (rev 98026)
+++ zope.principalregistry/trunk/src/zope/principalregistry/meta.zcml 2009-03-13 10:31:44 UTC (rev 98027)
@@ -1,35 +1,40 @@
<configure
xmlns="http://namespaces.zope.org/zope"
- xmlns:meta="http://namespaces.zope.org/meta">
+ xmlns:meta="http://namespaces.zope.org/meta"
+ >
- <meta:directive
- namespace="http://namespaces.zope.org/zope"
- name="principal"
- schema=".metadirectives.IDefinePrincipalDirective"
- handler=".metaconfigure.principal" />
+ <meta:directives namespace="http://namespaces.zope.org/zope">
- <meta:directive
- name="unauthenticatedPrincipal"
- namespace="http://namespaces.zope.org/zope"
- schema=".metadirectives.IDefineUnauthenticatedPrincipalDirective"
- handler=".metaconfigure.unauthenticatedPrincipal" />
+ <meta:directive
+ name="principal"
+ schema=".metadirectives.IDefinePrincipalDirective"
+ handler=".metaconfigure.principal"
+ />
+
+ <meta:directive
+ name="unauthenticatedPrincipal"
+ schema=".metadirectives.IDefineUnauthenticatedPrincipalDirective"
+ handler=".metaconfigure.unauthenticatedPrincipal"
+ />
+
+ <meta:directive
+ name="unauthenticatedGroup"
+ schema=".metadirectives.IDefineUnauthenticatedGroupDirective"
+ handler=".metaconfigure.unauthenticatedGroup"
+ />
+
+ <meta:directive
+ name="authenticatedGroup"
+ schema=".metadirectives.IDefineAuthenticatedGroupDirective"
+ handler=".metaconfigure.authenticatedGroup"
+ />
+
+ <meta:directive
+ name="everybodyGroup"
+ schema=".metadirectives.IDefineEverybodyGroupDirective"
+ handler=".metaconfigure.everybodyGroup"
+ />
- <meta:directive
- name="unauthenticatedGroup"
- namespace="http://namespaces.zope.org/zope"
- schema=".metadirectives.IDefineUnauthenticatedGroupDirective"
- handler=".metaconfigure.unauthenticatedGroup" />
+ </meta:directives>
- <meta:directive
- name="authenticatedGroup"
- namespace="http://namespaces.zope.org/zope"
- schema=".metadirectives.IDefineAuthenticatedGroupDirective"
- handler=".metaconfigure.authenticatedGroup" />
-
- <meta:directive
- name="everybodyGroup"
- namespace="http://namespaces.zope.org/zope"
- schema=".metadirectives.IDefineEverybodyGroupDirective"
- handler=".metaconfigure.everybodyGroup" />
-
</configure>
Modified: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principalregistry.py
===================================================================
--- zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principalregistry.py 2009-03-13 10:23:32 UTC (rev 98026)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principalregistry.py 2009-03-13 10:31:44 UTC (rev 98027)
@@ -16,37 +16,35 @@
$Id$
"""
import unittest
-from zope.authentication.basicauthadapter import BasicAuthAdapter
-from zope.authentication.interfaces import ILoginPassword, PrincipalLookupError
+from zope.authentication.interfaces import PrincipalLookupError
+from zope.authentication.loginpassword import LoginPassword
from zope.component import provideAdapter
from zope.interface import implements
from zope.password.testing import setUpPasswordManagers
-from zope.publisher.interfaces.http import IHTTPCredentials
from zope.principalregistry.principalregistry import PrincipalRegistry
from zope.principalregistry.principalregistry import DuplicateLogin, DuplicateId
-class Request(object):
+class Request(LoginPassword):
- implements(IHTTPCredentials)
+ challenge = None
def __init__(self, lpw):
- self.__lpw = lpw
+ if lpw is not None:
+ l, p = lpw
+ else:
+ l = p = None
+ super(Request, self).__init__(l, p)
- def _authUserPW(self):
- return self.__lpw
+ def needLogin(self, realm):
+ self.challenge = 'basic realm="%s"' % realm
- challenge = None
- def unauthorized(self, challenge):
- self.challenge = challenge
-
class Test(unittest.TestCase):
def setUp(self):
setUpPasswordManagers()
- provideAdapter(BasicAuthAdapter)
self.reg = PrincipalRegistry()
self.reg.definePrincipal('1', 'Tim Peters', 'Sir Tim Peters',
'tim', '123')
More information about the Checkins
mailing list