Sunday 13 January 2013

A Review of the Nagare Microframework

The analytics tell me that the keywords for this blog are "Best Python Framework" which is odd because I don't think I can pretend to have that answer. What I can do is point out what the differences are and let you find the one that suits you best. Nagare for example offers some concepts that you won't be used to if you come from using Django or Flask and the like.

If you have read Install Stackless Python on Ubuntu and could get stackless running the examples I showed you, then just follow these commands to get a stackless virtual environment running a nagare project called 'nagaredemo':

In the examples below, paste the code directly into the file
//negaredemo/demos/demos/app.py
and be aware that when you change the code you need to  restart the development server (Ctrl-C stops it.)

Hello World!



Okay, so example1 shows the basics of rendering a Welcome object.
http://localhost:8080/demos/
You'll notice immediately that we're not using a templating language here, but rather the built in Domain Specific Language (DSL). In reality you would use the DSL to build xhtml snippets and then use meld to insert them into templates. I've not used meld before, but it looks very straight forward - neat in fact. Now onto example2.

Callbacks



Here we've registered two callbacks on the DOM without having to explicitly declare the URL mappings. have a look at the rendered HTML to see how this has been implemented. Now, that's pretty handy.

Tiresome RESTful URLs



Example 3 takes that same code and augments it to allow us to have more ReSTful URLs. I'm not sure this is as obvious as I'd like, but it works I suppose.
http://localhost:8080/demos/Counter?value=7

Saving State Automatically


Nagare can hide the request/response object and global session from the developer. Object states are automatically saved in a server side session during the request/response round-trip. This allows for a more direct style of programming like in a desktop application.

And there's more


There's more documentation on the Nagere website itself, so scoot along there and see what else there is to offer. Nagare is built upon ConfigObj, WebOb, Paste, PEAK-Rules and lxml, so it's on good foundations. I'm told by Hervé Coatanhay that the next release will introduce non stackless support using pypy or CPython.

Conclusion


Nagare is able to implement Continuations and that's a great thing. However I'm not sure I like the way it obfuscates the implementation. I'd much rather be able to see what was going on.

For example, saving state between requests is nice, but is it secure? Do I need to plough through the code to find out? In my opinion it would have been better to have offered a structure that allows for others to plug in solutions/implementations.

The documentation is somewhat limited, which is probably because the community is still fairly small. However sinceteh project has been running since 2008, perhaps that's something to be concerned about.

Thanks to Hervé Coatanhay for suggestion the illustrative code snippets.


10 comments:

  1. One thing that you can help clarify is difference between frameworks that build web applications (like google docs) versus frameworks that build websites (blogs, cms, etc)

    ReplyDelete
  2. In the Color Pink bonus the Pink Panther paints a wall. All the pink numbers are totaled to give the player’s cash prize. Wheel of Pink Bonus is another exciting game. The wheel has two layers. The outer one gives the multiplier. 야동

    ReplyDelete
  3. You possess lifted an essential offspring. Bless for using. I would want to study better latest transactions from this blog. Preserve posting. 오피

    ReplyDelete
  4. Menuco helps you to grow your business online. We will create your website, an online ordering system, and a rock-solid online presence. With Menuco grow more. You will get more sales. Stop relying on other applications. Get your own application and website. 마사지

    ReplyDelete
  5. Every device needs to be pre-set for proper use. That’s why we have a web page mywifiext.net for our Netgear Wi-Fi Extender users. It’s quite easy to set up your Netgear Extender device. Just go to mywifiext.net and follow a few simple steps written on the page. We know how to value all our customers. So, we tried to keep the steps as simple as possible. We hope you do not encounter any problems during the process. But if you still can not get your device started, we are always happy to help. Just go to Netgear support for further assistance. 건전마사지

    ReplyDelete
  6. Explore the ultimate solution for your digital infrastructure with managed digitalocean services. Experience seamless deployment, optimization, and support.

    ReplyDelete