Skip to content

Commit

Permalink
renamed getRequestPublication() to just __call__()
Browse files Browse the repository at this point in the history
  • Loading branch information
zopyx committed Oct 7, 2005
1 parent 1fbf340 commit 6166246
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@ def canHandle(environment):
to make a decision based on the HTTP headers.
"""

def getRequestPublication():
def __call__():
""" returns a tuple (request, publication) """
8 changes: 4 additions & 4 deletions publicationfactories.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def canHandle(self, environment):
self.soap_req = component.queryUtility(interfaces.ISOAPRequestFactory)
return bool(environment.get('HTTP_SOAPACTION') and self.soap_req)

def getRequestPublication(self):
def __call__(self):
return self.soap_req, SOAPPublication


Expand All @@ -51,7 +51,7 @@ class XMLRPCFactory(object):
def canHandle(self, environment):
return True

def getRequestPublication(self):
def __call__(self):
request_class = component.queryUtility(
interfaces.IXMLRPCRequestFactory, default=XMLRPCRequest)
return request_class, XMLRPCPublication
Expand All @@ -64,7 +64,7 @@ class HTTPFactory(object):
def canHandle(self, environment):
return True

def getRequestPublication(self):
def __call__(self):
request_class = component.queryUtility(
interfaces.IHTTPRequestFactory, default=HTTPRequest)
return request_class, HTTPPublication
Expand All @@ -76,7 +76,7 @@ class BrowserFactory(object):
def canHandle(self, environment):
return True

def getRequestPublication(self):
def __call__(self):
request_class = component.queryUtility(
interfaces.IBrowserRequestFactory, default=BrowserRequest)
return request_class, BrowserPublication
Expand Down
8 changes: 4 additions & 4 deletions tests/test_publicationfactories.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_soapfactory(self):
self.assertEqual(factory.canHandle(env), False)
env['HTTP_SOAPACTION'] = 'server:foo'
self.assertEqual(factory.canHandle(env), True)
request, publication = factory.getRequestPublication()
request, publication = factory()
self.assertEqual(isinstance(request, DummyRequestFactory), True)
self.assertEqual(publication, SOAPPublication)

Expand All @@ -78,7 +78,7 @@ def test_xmlrpcfactory(self):
env = self.__env
factory = XMLRPCFactory()
self.assertEqual(factory.canHandle(env), True)
request, publication = factory.getRequestPublication()
request, publication = factory()
self.assertEqual(isinstance(request, DummyRequestFactory), True)
self.assertEqual(publication, XMLRPCPublication)

Expand All @@ -90,7 +90,7 @@ def test_httpfactory(self):
env = self.__env
factory = HTTPFactory()
self.assertEqual(factory.canHandle(env), True)
request, publication = factory.getRequestPublication()
request, publication = factory()
self.assertEqual(isinstance(request, DummyRequestFactory), True)
self.assertEqual(publication, HTTPPublication)

Expand All @@ -102,7 +102,7 @@ def test_browserfactory(self):
env = self.__env
factory = BrowserFactory()
self.assertEqual(factory.canHandle(env), True)
request, publication = factory.getRequestPublication()
request, publication = factory()
self.assertEqual(isinstance(request, DummyRequestFactory), True)
self.assertEqual(publication, BrowserPublication)

Expand Down

0 comments on commit 6166246

Please sign in to comment.