Authentication & authorisation chapter doesnt provide such common information - how to get info about currently logged user.
David On 28 čnc, 03:18, Stewart Greenhill <stewart.greenh...@gmail.com> wrote: > Hi and Thanks! I'm just starting with web2py - I read the old book > last week and am now doing some preliminary coding. > > Here are some initial comments on the new book. More to come as I work > with it... > > I prefer the new layout. The book is easier to read with chapter per > page BUT it would be useful to have the section headings at the top > with links to the relevant parts of the page. > > The "Migrations" section starts: > We refer to this behavior as a "migration". web2py logs all > migrations and migration attempts in the file "databases/sql.log". > But doesn't actually define the behaviour. A new section "Record > representation" breaks the flow of the previous discussion. I suggest > you move this material to the Migrations section, maybe with an > introductory sentence so that it stands alone: > > "If the table does exist but differs from the one being defined, it > generates the SQL to alter the table and executes it. If a field has > changed type but not name, it will try to convert the data(If you do > not want this, you need to redefine the table twice, the first time, > letting web2py drop the field by removing it, and the second time > adding the newly defined field so that web2py can create it.). If the > table exists and matches the current definition, it will leave it > alone. In all cases it will create the db.person object that > represents the table." > > Also, web2py Migrations are quite different to Rails Migrations. > - Rails migrations are hand-written. Web2py migrations are deduced > from changes to the models. > - Rais migrations are bi-directional in that they can be reversed > - Rails migrations can be applied to another database with the same > structure (important). This allows changes in the structure of a > development database to be then applied to a production database. > > Is there a way that web2py migrations can be transferred between > copies of a database? (eg. by running SQL statments from the log) > > Many-To-Many relations: > > Relations seem to be accessible via a field in the related objects > that has the name of the realtion. This selects the set of relations > that involve the original object. > > In the "dog ownership" example, I can do this: > > p = db(db.person.id==1).select().first() > for r in p.ownership.select(): > print r.person.name, r.dog.name > > I couldn't find this functionality documented anywhere, though it is > very useful (eg. in forms for enumerating related objects). Or maybe > it is somewhere else and I missed it...? > > Cheers, > Stewart > > On Jul 27, 6:49 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > This is very very preliminary: > > > http://web2py.com/book2 > > > It is not editable (yet) and I am still adding material but it does > > address a lot of issues. > > Please use this thread to add comments in particular: > > > What sections are missing? > > What needs to be clarified? > > Are there spelling errors? > > Are there formatting error? > > > One more way I could use help: I need all the images done with the old > > layout to be redone with the new welcome layout. > > > Massimo