1) You can return anything your want:
def index():
a = {}
b = {}
return {'a':a, 'b':b}
2) Not really but you should look into gluon/contrib/webclient.py and
doctests. Web2py runs doctests in controllers automatically.
On Saturday, 17 May 2014 07:23:33 UTC-5, Christopher Power wrote:
>
> Hi all,
>
> I'm a relatively new user of Web2Py. I looked at it about a year ago and
> loved a lot of its features, but ended up having to teach PHP to my
> undergrads for a variety of reasons that are too boring to go into. Blech.
>
> Anyways ... this year I'm insisting on using Web2Py for my course. I'm
> also going to be using it on a few of my own projects to get up to speed on
> the idiosyncrasies on the framework. I've been successful doing some
> relatively complex queries and pulling data from some ugly legacy database,
> so that has all gone pretty well.
>
> With all of that boring information out of the way - I'm looking for a bit
> of advice on a few things (probably the first of many). Hopefully these
> questions aren't too basic - I did a search and didn't find anything.
>
> 1) Is there a way that I can return multiple dict's from a Controller to a
> View? I have a situation where I need to return the results of two
> different queries back to the
> view for display. I certainly can do that by manipulating the dict's and
> slamming them together - but is there a way to return multiple dicts as in
> regular python? When I tried the python way or returning multiple dicts
> the server just couldn't return anything (even an error) - I just got a 303.
>
> 2) I currently have information pulling from a collection of documents
> called a cartulary (long story on that project). So when I select from
> default/index the name
> of a collection I go from:
> http://127.0.0.1:8000/deeds/default/index
> to
> http://127.0.0.1:8000/deeds/default/cartulary/0001
>
> As expected, where 0001 is the identifier for the cartulary.
>
> Now, on that page is a list of documents. I would like to have the
> situation where if the user selects a document id, the system displays a
> page of the document at
> the URL:
> http://127.0.0.1:8000/deeds/default/cartulary/0001/document/1
>
> Where 1 is the id of the document in the collection. How is the best way
> to do this? Right now I have it directing to /default/documents/1 through
> the default controller and that is okay - but not quite what I want.
>
> 3) I teach my students test driven development. Before I start diving
> into it myself - is there anything built into Web2Py that I've missed for
> doing test driven development or the related behaviour driven development?
>
> Cheers
> Chris
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.