On Jan 30, 1:21 pm, Mike Orr <sluggos...@gmail.com> 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 >Month class just to traverse through them. What are you gaining? Simplicity. If you're going to use the subpath, then your view callable has to know something about the structure of the site. During traversal, the successive contexts don't have access to the subpath -- the view callable gets that as part of the request, after traversal is finished. So each step of the traversal is ignorant about what's downstream. When you instantiate a temporary ArchiveYear object, you don't know whether its __getitem__ method will be called, or its default view, or a named view. (The default view, not shown in Tres' ArchiveYear, might go to the datastore for monthly counts of posts, or a list of all the posts in the year.) Similarly, the ArchiveMonth object knows its own year and month values, but not whether it will be called on to deliver an ArchiveDay or a list of posts for the month. >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? I haven't used repoze.folder yet, but I'm going to check it out, thanks for the tip. Per Tres' remark this morning, Chris' reliance on folders may have something to do with prolonged exposure to Zope ... -- 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.