[web2py] routes.py and rewriting URLs

2011-08-14 Thread fishwebby
Hi, I'm struggling with the routing in web2py and I'm hoping someone can point me in the right direction (I'm a web2py newbie). I want to change this (which works): http://127.0.0.1:8000/init/admin_courses/index to this: http://127.0.0.1:8000/admin/courses but I can't get it to work with the

[web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread fishwebby
;t hard code any URLs I'm assuming) On Aug 14, 6:08 pm, Jonathan Lundell wrote: > On Aug 14, 2011, at 3:26 AM, fishwebby wrote: > > > I'm struggling with the routing in web2py and I'm hoping someone can > > point me in the right direction (I'm a web2py newbi

[web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread fishwebby
!  If you edit routes.py, SHUTDOWN AND > RESTART WEB2PY! > > The routing lists are initted at web2py startup, not on every http > request! > > Rufus > > On Aug 14, 6:26 am, fishwebby wrote: > > > > > > > > > Hi, > > > I'm struggli

[web2py] Scope authenticated users in accounts

2011-08-15 Thread fishwebby
(web2py newbie here) - I've got user authentication working ok, but I'd like to be able to scope the auth_users inside an account. My plan is to have accounts identified by subdomains, e.g. account_one.example.com, and then inside that the users can login (a la Basecamp). I've got the following wo

[web2py] Re: Scope authenticated users in accounts

2011-08-15 Thread fishwebby
single > database table by subdomain so any queries return only results related to > the particular subdomain. > > Also, rather than creating your own requires_account decorator, you could > probably just use auth.requires > (seehttp://web2py.com/book/default/chapter/08#Combining-

[web2py] Google datastore concepts - denormalising and list:reference fields

2011-08-17 Thread fishwebby
Hi, I'm currently learning web2py for deployment on Google App Engine, and I've got a couple of questions about how the datastore works. Let's say I've got a relational database with students, courses and enrolments. Enrolments is the join table that allows a many to many relationship between stud

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-17 Thread fishwebby
(posting Massimo's reply) > e.g. 1, "Physics 101", 4|5|6 > Is that how data has to be modelled using the GAE datastore? No. On GAE 'list:reference' maps into a ListProperty of integers > If so, is > it possible to do the following: > > - paginate the denormalised data, for example show a paginat

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-17 Thread fishwebby
;s from 2009 so it may have changed a bit but the concepts are clearly explained by the presenter. Best wishes Dave On Aug 17, 1:40 pm, fishwebby wrote: > (posting Massimo's reply) > > > e.g. 1, "Physics 101", 4|5|6 > > Is that how data has to be modelled

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-17 Thread fishwebby
> > - paginate the denormalised data, for example show a paginated list of > > students on a course? > > You cannot. ListProperty does not allow this. How about something like this? limitby = (0, 10) students = db(db.student.id.belongs(course.students)).select(limitby = limitby) (where course.st

[web2py] belongs and orderby not working on gae?

2011-08-17 Thread fishwebby
Hi, I've got the following query to select auth_users from a list of IDs, then ordered by name: users = db(db.auth_user.id.belongs((1,2,3))).select(orderby = db.auth_user.first_name) which works fine in sqlite, but when deployed to gae the orderby doesn't work. Do belongs and orderby not work tog

[web2py] how to get number of rows returned by a query

2011-08-18 Thread fishwebby
Hi, I'm trying to get the number of rows returned by a query, so I can display "No rows found" in the view if none are returned, but I can't seem to find a way to do it - my query code is rows = db().select(db.course.id, db.course.title, orderby = db.course.title) Is there something like rows.cou

[web2py] Re: how to get number of rows returned by a query

2011-08-18 Thread fishwebby
I knew there would be a simple answer - thank you!

[web2py] Re: how to get number of rows returned by a query

2011-08-18 Thread fishwebby
'No rows found'}} > {{pass}} > > An empty rows object evaluates to False. > > Anthony > > > > > > > > On Thursday, August 18, 2011 8:12:57 AM UTC-4, fishwebby wrote: > > I knew there would be a simple answer - thank you!

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-19 Thread fishwebby
That's good to know, thanks - so for more than 30 items, something like this people = db(db.person.id.belongs(course.students)).select() isn't possible? Would it be possible for you to give me an example of using join tables? (I think my brain is still in SQL mode and I can't work out how I'd d

[web2py] How to get the referenced objects from a list:reference

2011-08-20 Thread fishwebby
Hi, I'm trying to do something quite straightforward but can't seem to work out how to do it: for a list:reference field, get all the items in the reference field (not just their IDs). For example, a person with many courses: db.define_table('course', Field('title')) db.define_table('person',

[web2py] Re: How to get the referenced objects from a list:reference

2011-08-21 Thread fishwebby
d-contains > . > > Anthony > > > > > > > > On Saturday, August 20, 2011 1:58:04 PM UTC-4, fishwebby wrote: > > Hi, I'm trying to do something quite straightforward but can't seem to > > work out how to do it: for a list:reference field, get all the items

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-21 Thread fishwebby
Ah ok, that makes sense. Is it really that easy to come up with a web request that takes more than thirty seconds? I'll have to watch out for that... I'm thinking now that I'm going about this the wrong way as regards the design for the datastore - from what I've read, "contains" is an efficient w

[web2py] Re: How to get the referenced objects from a list:reference

2011-08-22 Thread fishwebby
Yeh, that's what I've found myself doing. Now that I'm just assuming that the datastore is a list of objects identified by keys, I'm getting on much better with it (although like you say, some of my controller code is a little ugly but worth the price I think!) Cheers Dave On Aug 21, 11:56 pm, h