Widget oriented

31 views
Skip to first unread message

Kristian Benoit

unread,
Jun 30, 2011, 5:43:42 PM6/30/11
to pylons-...@googlegroups.com
I'm not so familiar with web development and am currently writting a social network like app using pyramid.

It seems to me that setting a renderer (inheriting a global layout) to a view and passing a few variables to modify the content of that renderer, is a little limited. I was inspired by the way deform works and thought about creating widgets (rendered html code) in the views, and pass those to the view renderer.

That's not so much the design style that tutorials showed me, but seems much more object oriented. I'd like to know a little more about the techniques and patterns you are using to have good designs.

Thanks,
Kristian

Eric Rasmussen

unread,
Jul 1, 2011, 12:02:30 AM7/1/11
to pylons-...@googlegroups.com
Hi Kristian,

For UI-intensive applications I like to go the ajax route. It works well because Pyramid can focus on tasks like security, validation and processing of data, and updating the database, while only returning the minimal amount of information the client-side application needs to function. This could mean returning a json reply that everything was ok, flashing back a message that it isn't, or sending only the snippet of html needed for a form or other feature. The javascript then makes decisions about where and how those responses interact with the client.

I've found that during the development phase this often keeps things much simpler (provided you're willing to learn a javascript framework and/or a lot of javascript), and makes it easy to separate out the ideas of what the client sees vs how you handle data on the server.

I've been stalling for months on writing a tutorial to demonstrate how you can structure a UI-rich application with Pyramid, partly because it'd rely heavily on YUI for the client-side features, and that's not something everyone wants to learn or use. It comes down to me being most comfortable with YUI and too stubborn to use another framework, though I believe the Pyramid techniques would work well with any javascript framework. If there is a real interest in this I can try to put together a shortish demo.

Take care,
Eric


--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-...@googlegroups.com.
To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.

Bruce Wade

unread,
Jul 1, 2011, 2:51:56 AM7/1/11
to pylons-...@googlegroups.com

I'd be interested in seeing that :-)

Thomas G. Willis

unread,
Jul 1, 2011, 9:13:56 AM7/1/11
to pylons-...@googlegroups.com
yeah pyramid works fine for rich ui's. my day job uses gwt for the front end and pyramid for the back. 

Matt Feifarek

unread,
Jul 1, 2011, 2:48:47 PM7/1/11
to pylons-...@googlegroups.com
On Thu, Jun 30, 2011 at 11:02 PM, Eric Rasmussen <ericra...@gmail.com> wrote:
I've been stalling for months on writing a tutorial to demonstrate how you can structure a UI-rich application with Pyramid, partly because it'd rely heavily on YUI for the client-side features, and that's not something everyone wants to learn or use. It comes down to me 

I really like YUI too, and am always "sad" that the "winner" appears to be jQuery.

I'd be really interested in seeing this tutorial. 

Mengu

unread,
Jul 1, 2011, 7:48:29 PM7/1/11
to pylons-discuss
for RIA i strongly recommend looking at qooxdoo. it is awesome and
supporting mobile platforms.

Benjamin Sims

unread,
Jul 1, 2011, 7:57:12 PM7/1/11
to pylons-...@googlegroups.com
I'd be very interested in seeing that.

As a Pyramid first-timer, I find the documentation itself to be very solid. What I miss are the cookbook-style blog posts which spring up when projects have been around for a long time (How to do X with Pyramid). So, any such tutorials would be very much appreciated!

Chris McDonough

unread,
Jul 1, 2011, 7:58:35 PM7/1/11
to pylons-...@googlegroups.com
On Sat, 2011-07-02 at 00:57 +0100, Benjamin Sims wrote:
> I'd be very interested in seeing that.
>
> As a Pyramid first-timer, I find the documentation itself to be very
> solid. What I miss are the cookbook-style blog posts which spring up
> when projects have been around for a long time (How to do X with
> Pyramid). So, any such tutorials would be very much appreciated!

http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/

> To unsubscribe from this group, send email to pylons-discuss
> +unsub...@googlegroups.com.


> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "pylons-discuss" group.
> To post to this group, send email to pylons-...@googlegroups.com.

> To unsubscribe from this group, send email to pylons-discuss
> +unsub...@googlegroups.com.

Chris McDonough

unread,
Jul 1, 2011, 8:36:47 PM7/1/11
to pylons-...@googlegroups.com
On Sat, 2011-07-02 at 01:14 +0100, Benjamin Sims wrote:
> Thanks Chris, I should have said that I have used the cookbook
> ('Making A “User Object” Available as a Request Attribute' was very
> useful). I just wanted to encourage further work along those lines.
>
> As an example, I have just been adding database-based authentication.
> I have worked it out I think, but I couldn't find specific
> instructions on how to do it, or if there is a 'correct' way to do it
> with SQLAlchemy.

The way I'd do it would probably be to implement a custom authentication
policy
(http://docs.pylonsproject.org/projects/pyramid/1.1/narr/security.html#creating-your-own-authentication-policy) but using a built-in authentication policy with a "callback" (aka "groupfinder" ala the tutorials) is another option. Either way is "correct".

> I understand that Pyramid deliberately doesn't specify these things
> and I don't expect hand holding - just adding my encouragement from a
> relative newbie perspective.

Sure. I add stuff to the cookbook as it comes up based on repeat
requests for info, so we're almost literally writing the cookbook right
now.

- C

Benjamin Sims

unread,
Jul 1, 2011, 8:14:31 PM7/1/11
to pylons-...@googlegroups.com
Thanks Chris, I should have said that I have used the cookbook ('Making A “User Object” Available as a Request Attribute' was very useful). I just wanted to encourage further work along those lines.

As an example, I have just been adding database-based authentication. I have worked it out I think, but I couldn't find specific instructions on how to do it, or if there is a 'correct' way to do it with SQLAlchemy.

I understand that Pyramid deliberately doesn't specify these things and I don't expect hand holding - just adding my encouragement from a relative newbie perspective.

On 2 July 2011 00:58, Chris McDonough <chr...@plope.com> wrote:

Steve Piercy

unread,
Jul 1, 2011, 9:01:23 PM7/1/11
to pylons-discuss
On Jul 1, 5:36 pm, Chris McDonough <chr...@plope.com> wrote:
> On Sat, 2011-07-02 at 01:14 +0100, Benjamin Sims wrote:
> > I understand that Pyramid deliberately doesn't specify these things
> > and I don't expect hand holding - just adding my encouragement from a
> > relative newbie perspective.
>
> Sure.  I add stuff to the cookbook as it comes up based on repeat
> requests for info, so we're almost literally writing the cookbook right
> now.

As a fellow newbie, I scratched that itch and wrote a recipe for the
cookbook, with help from several folks at the Pylons Project Mini-
Conference a few months ago.
http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/mac_install.html

I think it was Ben Bangert who made a point at the mini-conf that
there is a big need to help newbies get up and running and doing stuff
with Pyramid with narrative style documentation. So I took it as a
challenge to learn, then pass along my experience with a recipe. The
resulting interaction and feedback helped me learn even more.

To create a new recipe, it's pretty easy. Get the docs from the repo,
write a new recipe with Sphinx, then make a pull request for review.
If you feel so inclined to do so, too, and find you need help, you can
hit up folks in IRC in #pyramid or #pylons pretty much 24/7.

Maybe I'll write a recipe on how to write a recipe.

--steve
Reply all
Reply to author
Forward
0 new messages