I've added a new method: Application.callMethodOfServlet().  You can use it
when you need to call a method of another servlet and get a response, rather
than transferring control to another servlet (as Application.forward() does)
or including the response from another servlet in your current servlet's
response (as Application.includeURL() does).  What callMethodOfServlet does
in detail is:

- get an instance of the servlet from the pool, or create one if necessary
- call servlet.awake()
- call the method you specify with the arguments you specify, remembering
the result
- call servlet.sleep()
- return the servlet instance to the servlet pool
- return the result from calling the method

I've also added convenience methods to Page: forward(url), includeURL(url),
and callMethodOfServlet(url, method, *args, **kwargs).  These act the same
as the methods of the same name in Application, but do not take the
transaction as the first argument.  This is much more convenient, so the
methods in Page should be considered the "correct" way to do these
operations.

Some examples:

        # Transfer control to SomeOtherServlet
        self.forward('SomeOtherServlet')

        # Include the response from SomeOtherServlet
        self.includeURL('SomeOtherServlet')

        # Call a method on SomeOtherServlet
        result = self.callMethodOfServlet('SomeOtherServlet', 'add', 1, 2)
        assert result == 3

where SomeOtherServlet might contain this:

class SomeOtherServlet(Page):
        def add(self, a, b):
                return a+b

-- 

- Geoff Talvola
  [EMAIL PROTECTED]

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to