On Sun, Jan 30, 2011 at 8:25 AM, Wade Leftwich <wleftw...@gmail.com> 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'] > year = archive['2011'] = archive.__getitem__('2011') = Year(y=2011) > month = year['01'] = year.__getitem__('01') = Month(y=2011, m=1) > day = month['29'] = month.__getitem__('01') = Day(y=2011, m=1, d=29) > post = day['my-post-about-pyramid'] = day.__getitem__('my-post-about- > pyramid') = Post(y=2011, m=1, d=29, slug='my-post-about-pyramid') > ... and the default view for Post would be to query Mongo > > 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() .
Are you traversing each level of the date here, or using a subpath from archive? It seems like extra overhead to create a temporary Year class and Month class just to traverse through them. What are you gaining? I'm thinking of making a CMS site with articles embedding nested comments. Chris suggested making the article a repoze.folder.Folder subclass. I said it seems funny to think of an artlcle as a folder. He said he makes almost everything folders nowadays, as it makes it easier to both use the object and traverse through it. Could ArchiveYear and ArchiveMonth be made into Folder subclasses to factor away some of the code? -- Mike Orr <sluggos...@gmail.com> -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.