Anthony, you are right. I am new to web2py and following this example from the book. It actually gives me an impression that index.html is not used since it is mentioned that index.html will be modified and it is immediately following the line where it is mentioned generic.html will be used if view is not used.
Since this example in the beginning of the book in the overview chapter, most of the users doesn't reads the proper contents of index.html which may confuse users. Thanks everyone for spending time on my doubt :) -Sarbjit On Friday, March 15, 2013 6:51:18 PM UTC+5:30, Anthony wrote: > > Note, generic.html is not being used. The following two sentences are > simply explaining how web2py works, not what is happening in this > particular example: > > When developing, if there is no view, the action is rendered by the >> "generic.html" view that is provided with every web2py application. > > > If you do not write a view, the dictionary is rendered by >> "views/generic.html" and a call to the index action would look like this > > > These sentences are not saying the generic.html view is being used -- only > that it would be used *if* no index.html view existed. > > However, the following sentence is confusing: > > You have not created a view for this action yet, so web2py renders the set >> of records in plain tabular form. > > > This seems to imply that there is no index.html, but in fact it simply > means that the index.html that does exist has not yet been customized to > handle the data produced by the new index() function. The default > index.html view includes some code much like the generic.html view that > allows it to generate a default display for any data. The next sentence > provides instruction for customizing the default index.html view for this > example: > > Proceed to create a view for the index action. Return to admin, edit >> "default/index.html" and replace its content with the following: > > > This could probably be made more clear. > > Anthony > > On Thursday, March 14, 2013 11:38:45 PM UTC-4, Sarbjit singh wrote: >> >> Let me explain : >> >> As per that example, we create a new appliance which means >> default/index.html does exists and we are modifying controllers/default.py >> index function as shown in original post. So my question is if >> default/index.html does exist, then why generic.html is being used? >> >> hope this clears my doubt >> >> -Sarbjit >> >> >> On Thursday, March 14, 2013 9:04:31 PM UTC+5:30, Mark wrote: >>> >>> If you don't have a view (such as index.html), the generic view >>> (generic.html) will be used. Isn't it clear? >>> >>> On Thursday, March 14, 2013 7:54:38 AM UTC-4, Sarbjit singh wrote: >>>> >>>> In the 5th edition of web2py manual, for the example of images app, I >>>> have one doubt :- >>>> >>>> As per that app code, we create db in models (db.py) and then we write >>>> some code in controller (default.py) as :- >>>> >>>> def index(): >>>> images = db().select(db.image.ALL, orderby=db.image.title) >>>> return dict(images=images) >>>> >>>> In the documentation it is written :- >>>> >>>> If you do not write a view, the dictionary is rendered by >>>> "views/generic.html" and a call to the index action would look like this: >>>> >>>> It seems to work like this only but my question is when we create a new >>>> app as specified in the manual. default/index.html is already present >>>> (index name is same as my function name in default.py), then why >>>> generics.html is being used and not index.html which is already present. >>>> In >>>> first example, index.html is seemed to be used. >>>> >>>> Thanks >>>> Sarbjit >>>> >>> -- --- 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/groups/opt_out.

