[PEAK] Example using sitemap.xml and bulletins

Tiago Cogumbreiro cogumbreiro at gmail.com
Sat Mar 26 17:27:08 EST 2005

On Sat, 26 Mar 2005 15:28:13 -0500, Phillip J. Eby
<pje at telecommunity.com> wrote:
> At 06:58 PM 3/26/05 -0100, Tiago Cogumbreiro wrote:
> >On Sat, 26 Mar 2005 14:30:57 -0500, Phillip J. Eby
> ><pje at telecommunity.com> wrote:
> > > As part of this, I'd also get rid of the 'bulletins.databaseURL' property
> > > and change the 'bulletins' start file to read something like:
> > >
> > >      [Named Services]
> > >      bulletins.db = naming.LinkRef("sqlite:///tmp/bulletins.db")
> >What about the DDL?
> It would remain the same.
doh :D sorry for the stupid question ;) I just realized what I had
asked after you replied...

> > > >Can I embedd views inside of each other?
> > >
> > > I don't understand the question.
> > >
> > >
> >I was trying to ask if I could could reuse views/templates inside each
> >other.
> Within a template, the 'this:replace' and 'content:replace' operations will
> insert the specified view of the "current object".  Or more precisely, they
> will use URL traversal from the current object to the supplied path.
> >I was thinking in terms of the widget analogy.
> Yes, view templates can be HTML snippets to create widgets.  In fact, by
> default a template can only be used as a web page if it contains a
> definition for "page" or "page-layout"; otherwise it is only usable as a
> "fragment"; i.e. it is only embeddable within other templates, and not
> usable as a standalone page.
> A "layout" is a template that acts as a macro for laying out a page or
> fragment.  Within a layout template, you use paths like "/params/foo" to
> refer to blocks that were defined in the calling template.  This is
> basically the same as ZPT macros, except that instead of fill-slot you use
> "this:is" or "content:is" attributes to name blocks, and instead of
> define-slot you use "this:replace='/param/slotName'" or
> "content:replace='/param/slotName'" in the layout to insert the supplied data.
> But this is something that probably should be left to a tutorial document,
> as for simple things you don't need any layouts at all, but peak.web can
> actually use the same template as both a fragment and a page, and lay the
> information out in different ways depending on how it is being used.  This
> is particularly useful for creating components that can then work within
> the look-and-feel of any site.  To some extent, this will require a common
> vocabulary of parameters or slot names, however.
> Anyway, the simplest way to have a template work as a page is to add
> "with:page-layout='/default'" as an attribute on the outermost XHTML
> element of your template.  You do not need to do anything special to make a
> template work when referenced by another template, unless you want it to
> only use part of the page.
> For example, suppose you've created a template that displays a bulletin
> object, and you'd like to embed it in another page that displays multiple
> bulletins, but you'd also like it to work as a standalone page.  You can do
> this by marking the document with "this:is='page'", and by marking the
> inner part that just displays the bulletin as "this:is='fragment'".  Then,
> when you go directly to that view template via a web browser, the whole
> template is rendered.  But, if you reference it from inside another
> template, then only the part marked as a fragment will be displayed.
Hmm so many cool stuff in one framework :)

Currently I'm doing some project and using PEAK, but because I need to
have it done ASAP i am using CherryPy instead of peak.web. It's not
integrated like peak.web is (for obvious reasons) but it's very nice
to be used with it nonetheless. CherryPy provides a way for me to
publish my "location"s which reflect to Peak components. So as you can
imagine one almost thinks the two frameworks were written in a joined
effort ;)

I don't know if there is interest for me to share this experience to
be in the wiki. I have used peak.security as well and written some
code to integrate the two (Peak and CherryPy).

Tiago Cogumbreiro <cogumbreiro at users.sf.net>


More information about the PEAK mailing list