l.t.publication : module documentation

Part of lp.testing

Helpers for testing out publication related code.
Function get_request_and_publication Helper method that return the IRequest and IPublication for a request.
Function print_request_and_publication Helper giving short names for the request and publication.
Function test_traverse Traverse the url in the same way normal publishing occurs.
def get_request_and_publication(host='localhost', port=None, method='GET', mime_type='text/html', in_stream='', extra_environment=None):
Helper method that return the IRequest and IPublication for a request.

This method emulates what the Zope publisher would do to find the request and publication class for a particular environment.

def print_request_and_publication(host='localhost', port=None, method='GET', mime_type='text/html', extra_environment=None):
Helper giving short names for the request and publication.
def test_traverse(url):
Traverse the url in the same way normal publishing occurs.

Returns a tuple of (object, view, request) where:
  object is the last model object in the traversal chain
  view is the defined view for the object at the specified url (if
    the url didn't directly specify a view, then the view is the
    default view for the object.
  request is the request object resulting from the traversal.  This
    contains a populated traversed_objects list just as a browser
    request would from a normal call into the app servers.

This call uses the currently logged in user, and does not start a new
transaction.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.