how to build a portlet style site?

3 views
Skip to first unread message

Paul J Stevens

unread,
Jan 17, 2007, 7:33:57 AM1/17/07
to pylons-...@googlegroups.com

Hi all,

coming from the world of plone...

All the example code uses a single controller per page, which is all
good and fine for crud operations on a database, but seems rather
limited for what we do.

I'd like to build a website (read a typical portal site) that brings
together several controllers/views into a single page (i.e.
/doc/view/123, /news/latest, /user/list, /user/view/myid)

How to do this in pylons? Is this a templating issue? Is it possible to
render a template fragment using a different controller?

thanks a lot for our insight.

--
________________________________________________________________
Paul Stevens paul at nfg.nl
NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl

James Gardner

unread,
Jan 17, 2007, 7:55:15 AM1/17/07
to pylons-...@googlegroups.com
Hi Paul,

I'm developing a new templating system called art which handles this
particular case. Instead of using a controller to call a template and
display the result, the template effectively defines which content it
requires and calls the different controllers (called plugins in art)
automatically.

The individual plugins can run on multiple servers so that content can
be pulled in from remote locations and all the fetching is done in
parallel with threads so performance is pretty good.

There are some other features too such as the ability to define
templates from layout objects so that the people making the templates
don't necessarily need to know HTML, they just choose a header, footer
and two columns say.

If you are interested I'll try and put the latest code up in the next
few days.

Of course, in Pylons you can always have a single controller call
actions from other controllers (they are just WSGI applications) and
then assemble them yourself?

Cheers,

James

climbus

unread,
Jan 17, 2007, 8:12:10 AM1/17/07
to pylons-discuss
In our projects we used components folder where we put functions like:
def pool(id):
c.pool = model.Pools.get(id)
return render('pool_template')

in template with page we call pool(id) in somewhere we want.

This is very flexible solution. We can decorate function with cache,
authorization, add some layout or timing. We can use components in
different projects, with different templating etc.

Climbus

Message has been deleted

Ian Bicking

unread,
Jan 17, 2007, 10:18:10 AM1/17/07
to pylons-...@googlegroups.com
Paul J Stevens wrote:
> All the example code uses a single controller per page, which is all
> good and fine for crud operations on a database, but seems rather
> limited for what we do.
>
> I'd like to build a website (read a typical portal site) that brings
> together several controllers/views into a single page (i.e.
> /doc/view/123, /news/latest, /user/list, /user/view/myid)

I'd use subrequests, and then wrap that up in some object. I don't
believe Pylons exposes subrequests in a particularly friendly way, but
if you look at paste.recursive it will show you a not-as-friendly way to
do subrequests that you could pretty up on your own.


--
Ian Bicking | ia...@colorstudy.com | http://blog.ianbicking.org

Uwe Feldtmann

unread,
Jan 18, 2007, 2:36:22 AM1/18/07
to pylons-...@googlegroups.com
James Gardner wrote:
> I'm developing a new templating system called art which handles this
> particular case. Instead of using a controller to call a template and
> display the result, the template effectively defines which content it
> requires and calls the different controllers (called plugins in art)
> automatically.
>
> The individual plugins can run on multiple servers so that content can
> be pulled in from remote locations and all the fetching is done in
> parallel with threads so performance is pretty good.
>
> There are some other features too such as the ability to define
> templates from layout objects so that the people making the templates
> don't necessarily need to know HTML, they just choose a header, footer
> and two columns say.
>
> If you are interested I'll try and put the latest code up in the next
> few days.
I'm interested. Any seconds?

Paul J Stevens

unread,
Jan 18, 2007, 3:19:23 AM1/18/07
to pylons-...@googlegroups.com
Thanks for the feedback.

All three approaches (special template engine, components, sub-requests)
look very usefull. I've got some studying and experimentation to do.

--

equity....@gmail.com

unread,
Jan 18, 2007, 5:17:05 AM1/18/07
to pylons-discuss
We're waiting for the art templating system...

Cliff Wells

unread,
Jan 18, 2007, 7:25:35 PM1/18/07
to pylons-...@googlegroups.com
On Wed, 2007-01-17 at 12:55 +0000, James Gardner wrote:
> Hi Paul,
>
> I'm developing a new templating system called art which handles this
> particular case. Instead of using a controller to call a template and
> display the result, the template effectively defines which content it
> requires and calls the different controllers (called plugins in art)
> automatically.
>
> The individual plugins can run on multiple servers so that content can
> be pulled in from remote locations and all the fetching is done in
> parallel with threads so performance is pretty good.

I was looking at the W3C docs on XInclude (which, like most W3C docs,
aren't terribly enlightening) and this sounds a bit like that (Genshi
supports that particular feature, BTW). Any particular differences with
XInclude? I've been planning on adding a similar feature to Breve, but
am interested in other people's ideas on particulars.

Also, since you can pull plugins from different servers, have you
considered the implications with regard to Javascript? It seems there
might be some security implications (or more likely, security
restrictions) that would affect Javascript that is pulled from different
servers (although I expect simply documenting such restrictions would be
adequate).


Regards,
Cliff


Reply all
Reply to author
Forward
0 new messages