Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
app.run should be able to handle the output from controller commands #257
dispatch should return anything the controller commands return as well as the main app should try and render that output, if you override the render method you can control how and when that output is displayed, this way you can keep a lot of your controller commands as data in and data out and can easily be unit tested individually
OK, so it looks pretty simple of a change, however it interferes with the existing structure in that it is not strictly required that an application controller return a dict() nor render that dict(). That is a use case issue... some people don't use app.render() ... some commands don't render any output ... others would are much easier to handle with simple print statements. We currently don't enforce output rendering.
I believe that this change actually did break one of the tests in Travis because that test is using app.get_last_rendered() which accesses the last result after calling "app.render()".
This is how we currently handle testing output.... we run a command, then check the output of that command in "app.get_last_rendered()". That might be helpful to you.
I don't see a problem with returning the func() from CementBaseController._dispatch() as that doesn't break existing functionality. You could then jus tmodify your app to call app.render() on it to simplify your work flow.