Re: Pyramid: URLDispatch vs Traversal question

2011-02-01 Thread oO
Thanks for all the useful replies. I learned a lot in the last few days. Some things that I ended up implementing: 1. a generic BlogFolder class for all my resources that return a list of posts. I figured out that the context declaration for a view can be an inherited class, which is great. All th

Re: Pyramid: URLDispatch vs Traversal question

2011-01-31 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/30/2011 01:21 PM, Mike Orr wrote: > On Sun, Jan 30, 2011 at 8:25 AM, Wade Leftwich wrote: >> Actually a bit more in keeping with the spirit of Traversal, and again >> keeping your calls to Mongo to a mininum, would be something like >> this: >>

Re: Pyramid: URLDispatch vs Traversal question

2011-01-30 Thread Wade Leftwich
On Jan 30, 3:56 pm, oO wrote: > Thanks for the info. I'm following up on the idea of using > request.subpath, but at what point does this property get created? > This is my understanding of the call stack: > > 1. the RootFactory is called, with the request object as a parameter > 2. the RootFactor

Re: Pyramid: URLDispatch vs Traversal question

2011-01-30 Thread oO
Thanks for the info. I'm following up on the idea of using request.subpath, but at what point does this property get created? This is my understanding of the call stack: 1. the RootFactory is called, with the request object as a parameter 2. the RootFactory returns the root resource 3. Pyramid rec

Re: Pyramid: URLDispatch vs Traversal question

2011-01-30 Thread Wade Leftwich
On Jan 30, 1:21 pm, Mike Orr wrote: > Are you traversing each level of the date here, or using a subpath from > archive? Traversing each level -- the same pattern Tres described this morning as "transient" context classes. >It seems like extra overhead to create a temporary Year class and >Mon

Re: Pyramid: URLDispatch vs Traversal question

2011-01-30 Thread Mike Orr
On Sun, Jan 30, 2011 at 8:25 AM, Wade Leftwich wrote: > Actually a bit more in keeping with the spirit of Traversal, and again > keeping your calls to Mongo to a mininum, would be something like > this: > > /blog/month/2011/01/29/my-post-about-pyramid would do this: > > archive = Blog['archive'] >

Re: Pyramid: URLDispatch vs Traversal question

2011-01-30 Thread Wade Leftwich
> This would handle shorter paths in a natural way -- e.g. '/blog/month/ > 2011/01' would map to the default view for Month(y=2011, m=1), which > would call Post.list_posts_for_month() . > Er, make that "the default view for Month(y=2011, m=1), which would call Month.list_posts_for_month() which w

Re: Pyramid: URLDispatch vs Traversal question

2011-01-30 Thread Wade Leftwich
Actually a bit more in keeping with the spirit of Traversal, and again keeping your calls to Mongo to a mininum, would be something like this: /blog/month/2011/01/29/my-post-about-pyramid would do this: archive = Blog['archive'] year = archive['2011'] = archive.__getitem__('2011') = Year(y=2011)

Re: Pyramid: URLDispatch vs Traversal question

2011-01-30 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/30/2011 09:04 AM, Wade Leftwich wrote: > If you want to stick with Traversal, don't forget that you have > request.subpath available to you. For the path "/blog/archive/ > 2011/01/29/my-post-about-pyramid", you could have an Archive context > who

Re: Pyramid: URLDispatch vs Traversal question

2011-01-30 Thread Wade Leftwich
If you want to stick with Traversal, don't forget that you have request.subpath available to you. For the path "/blog/archive/ 2011/01/29/my-post-about-pyramid", you could have an Archive context whose default (unnamed) view would be called with a request that included request.subpath = ['2011', '

Re: Pyramid: URLDispatch vs Traversal question

2011-01-29 Thread Rob Miller
On 1/29/11 6:14 PM, oO wrote: Sorry if this is a newbie question, but I'm finding that I'm a little bit lost when it comes to the best way to implement an example application using MongoDB (or any non-ZODB datastore) and traversal. Conceptually, I like the idea of traversal instead of URL Dispat

Pyramid: URLDispatch vs Traversal question

2011-01-29 Thread oO
Sorry if this is a newbie question, but I'm finding that I'm a little bit lost when it comes to the best way to implement an example application using MongoDB (or any non-ZODB datastore) and traversal. Conceptually, I like the idea of traversal instead of URL Dispatch but I find I'm a little bit l