librelist archives

« back to archive

[Ann] Flask-Sijax

[Ann] Flask-Sijax

From:
Slavi Pantaleev
Date:
2011-03-03 @ 09:04
Hello!

I'd like to announce my recently released extension, which adds Sijax
support to Flask.

Sijax is a Python/jQuery library that makes AJAX easy to use in web
applications.

This is my first extension, so I hope I've done things as right as possible.
I know that the documentation is not very good - I'm yet to get around to
trying Sphinx and handle that.

There is however a lot of information (in `docs/` for both Flask-Sijax and
Sijax) and also examples, which could help you see what Flask-Sijax can
bring to your application.
You can take a look at the examples here:
https://github.com/spantaleev/flask-sijax/tree/master/examples
You should be able to run them straight from the tarball, provided you
install the dependencies (SIjax and Flask) before doing that.

Any comments will be appreciated.

Sijax and Flask-Sijax are on GitHub:
    https://github.com/spantaleev/sijax-python
    https://github.com/spantaleev/flask-sijax

Re: [flask] [Ann] Flask-Sijax

From:
leoomo
Date:
2011-03-03 @ 13:49
于 2011年03月03日 17:04, Slavi Pantaleev 写道:
> Hello!
>
> I'd like to announce my recently released extension, which adds Sijax 
> support to Flask.
>
> Sijax is a Python/jQuery library that makes AJAX easy to use in web 
> applications.
>
> This is my first extension, so I hope I've done things as right as 
> possible. I know that the documentation is not very good - I'm yet to 
> get around to trying Sphinx and handle that.
>
> There is however a lot of information (in `docs/` for both Flask-Sijax 
> and Sijax) and also examples, which could help you see what 
> Flask-Sijax can bring to your application.
> You can take a look at the examples here: 
> https://github.com/spantaleev/flask-sijax/tree/master/examples
> You should be able to run them straight from the tarball, provided you 
> install the dependencies (SIjax and Flask) before doing that.
>
> Any comments will be appreciated.
>
> Sijax and Flask-Sijax are on GitHub:
> https://github.com/spantaleev/sijax-python
> https://github.com/spantaleev/flask-sijax
Good job! :)

Re: [flask] [Ann] Flask-Sijax

From:
Slavi Pantaleev
Date:
2011-03-06 @ 19:38
Proper documentation is now available at
http://packages.python.org/Flask-Sijax/ and
http://packages.python.org/Sijax/ .
The extension should comply with the Flask guidelines for approved
extensions now.

On Thu, Mar 3, 2011 at 3:49 PM, leoomo <leoomo@gmail.com> wrote:

>  于 2011年03月03日 17:04, Slavi Pantaleev 写道:
>
> Hello!
>
>  I'd like to announce my recently released extension, which adds Sijax
> support to Flask.
>
>  Sijax is a Python/jQuery library that makes AJAX easy to use in web
> applications.
>
>  This is my first extension, so I hope I've done things as right as
> possible. I know that the documentation is not very good - I'm yet to get
> around to trying Sphinx and handle that.
>
>  There is however a lot of information (in `docs/` for both Flask-Sijax
> and Sijax) and also examples, which could help you see what Flask-Sijax can
> bring to your application.
> You can take a look at the examples here:
> https://github.com/spantaleev/flask-sijax/tree/master/examples
> You should be able to run them straight from the tarball, provided you
> install the dependencies (SIjax and Flask) before doing that.
>
>  Any comments will be appreciated.
>
>  Sijax and Flask-Sijax are on GitHub:
>     https://github.com/spantaleev/sijax-python
>      https://github.com/spantaleev/flask-sijax
>
> Good job! :)
>

Re: [flask] [Ann] Flask-Sijax

From:
Aaron Kavlie
Date:
2011-03-06 @ 23:02
Slavi,

Sijax caught my eye, as I'm interested to see anything that bridges the gap
between web frameworks and JS-heavy front-end development, which is becoming
increasingly common.

However, Sijax necessitates a trip to the server for basic JS that would
otherwise reside entirely client-side. Isn't that a significant downside
over straight JS?

On Sun, Mar 6, 2011 at 12:38 PM, Slavi Pantaleev <s.pantaleev@gmail.com>wrote:

> Proper documentation is now available at
> http://packages.python.org/Flask-Sijax/ and
> http://packages.python.org/Sijax/ .
> The extension should comply with the Flask guidelines for approved
> extensions now.
>
> On Thu, Mar 3, 2011 at 3:49 PM, leoomo <leoomo@gmail.com> wrote:
>
>>  于 2011年03月03日 17:04, Slavi Pantaleev 写道:
>>
>> Hello!
>>
>>  I'd like to announce my recently released extension, which adds Sijax
>> support to Flask.
>>
>>  Sijax is a Python/jQuery library that makes AJAX easy to use in web
>> applications.
>>
>>  This is my first extension, so I hope I've done things as right as
>> possible. I know that the documentation is not very good - I'm yet to get
>> around to trying Sphinx and handle that.
>>
>>  There is however a lot of information (in `docs/` for both Flask-Sijax
>> and Sijax) and also examples, which could help you see what Flask-Sijax can
>> bring to your application.
>> You can take a look at the examples here:
>> https://github.com/spantaleev/flask-sijax/tree/master/examples
>> You should be able to run them straight from the tarball, provided you
>> install the dependencies (SIjax and Flask) before doing that.
>>
>>  Any comments will be appreciated.
>>
>>  Sijax and Flask-Sijax are on GitHub:
>>     https://github.com/spantaleev/sijax-python
>>      https://github.com/spantaleev/flask-sijax
>>
>> Good job! :)
>>
>
>


-- 
freelance web development
aaron.kavlie.net

Re: [flask] [Ann] Flask-Sijax

From:
Slavi Pantaleev
Date:
2011-03-07 @ 06:53
Aaron,

you're right about that - each request makes a trip to the server.

You should use it whenever you need something from the server (be it
data or some processing that you would rather not do in the browser).
It makes no sense to have a server-side function that receives some
data from the client and send it back with only minor transformations
like some of the examples do.

For example:

def say_hi(obj_response, name):
    obj_response.alert('Hi %s' % name)

Sijax.request('say_hi', ['John']);

This makes no sense at all. You can stay on the clientside and just
show the alert yourself.
Still, the example is good at showing how arguments are passed around
and how things work.

Sijax is meant to act as a substitute for jQuery.ajax() in some of the
cases, because it allows you to use what you want and already know
(html(), attr(), css() and similar response methods) and push a
meaningful response to the client. Alternatively, you would have to
generate an XML or JSON response and go over it in the browser to
decide how to handle it.
I guess we could say that Sijax is to be used whenever you're thinking
of using jQuery.ajax() and Sijax would be the easier way to go.

-----------

What's good about Sijax is that it allows you to easily do a lot more
stuff, with less code.
Here's some other examples that are good candidates for using Sijax:

1. News feed - you can't stay completely on the clientside as you need
to fetch new items. You can do polling with
Sijax.request('update_news', [last_update_time]); which would simply
return an empty response if no new items are available, or render the
new items on the page.

2. Text transforming - say you want to use the contents of a textarea
and render them as a Markdown preview. You can easily pass the text
and have the serverside function assign the rendered markdown anywhere
you want (or pass it to a callback function). This could get heavy if
you do it often though, so you may want to get a javascript library to
transform your markdown text without going to the server.

3. Submitting forms - it's pretty easy to submit a form and decide
what to do with the data on the serverside.

$('#form_id').bind('submit', function () {
    Sijax.request('register_user', [Sijax.getFormValues('#form_id')]);
    return false;
});

Submitting the form like that gives you a lot of flexibility. The
server-side function can take many different paths and you don't have
to create code that handles that back in the browser:

* All data valid - setup session and redirect to dashboard
* Username taken - suggest some alternatives
* Invalid data - put some error messages on the page
* Registration failed for internal reasons - show an alert() or
something similar

4. Upload files - look at the Upload plugin included with the package
- it implements simple "hidden iframe" uploads

------------

I hope I've given you some ideas as to how Sijax would be a helpful
improvement on top of jQuery.ajax() to simplify web development.

On Mon, Mar 7, 2011 at 1:02 AM, Aaron Kavlie <akavlie@gmail.com> wrote:
> Slavi,
> Sijax caught my eye, as I'm interested to see anything that bridges the gap
> between web frameworks and JS-heavy front-end development, which is becoming
> increasingly common.
> However, Sijax necessitates a trip to the server for basic JS that would
> otherwise reside entirely client-side. Isn't that a significant downside
> over straight JS?
>
> On Sun, Mar 6, 2011 at 12:38 PM, Slavi Pantaleev <s.pantaleev@gmail.com>
> wrote:
>>
>> Proper documentation is now available
>> at http://packages.python.org/Flask-Sijax/ and 
http://packages.python.org/Sijax/ .
>> The extension should comply with the Flask guidelines for approved
>> extensions now.
>> On Thu, Mar 3, 2011 at 3:49 PM, leoomo <leoomo@gmail.com> wrote:
>>>
>>> 于 2011年03月03日 17:04, Slavi Pantaleev 写道:
>>>
>>> Hello!
>>> I'd like to announce my recently released extension, which adds Sijax
>>> support to Flask.
>>> Sijax is a Python/jQuery library that makes AJAX easy to use in web
>>> applications.
>>> This is my first extension, so I hope I've done things as right as
>>> possible. I know that the documentation is not very good - I'm yet to get
>>> around to trying Sphinx and handle that.
>>> There is however a lot of information (in `docs/` for both Flask-Sijax
>>> and Sijax) and also examples, which could help you see what Flask-Sijax can
>>> bring to your application.
>>> You can take a look at the examples
>>> here: https://github.com/spantaleev/flask-sijax/tree/master/examples
>>> You should be able to run them straight from the tarball, provided you
>>> install the dependencies (SIjax and Flask) before doing that.
>>> Any comments will be appreciated.
>>> Sijax and Flask-Sijax are on GitHub:
>>>     https://github.com/spantaleev/sijax-python
>>>     https://github.com/spantaleev/flask-sijax
>>>
>>> Good job! :)
>>
>
>
>
> --
> freelance web development
> aaron.kavlie.net
>