librelist archives

« back to archive

Using Flask_Sijax with blueprints

Using Flask_Sijax with blueprints

From:
chrickso
Date:
2012-07-03 @ 17:19
Hi,

I'm attempting to setup the flask_sijax extension with my blueprint flask
app. I have it starting up with the app correctly, I am just not sure how
to point the client side Sijax.request to the correct blueprint/function
and the chrome JS terminal reports:

POST http://lvh.me:5000/ 400 (BAD REQUEST)

when clicking on the Sijax link. The documentation mentions blue prints but
all the examples are assuming a single file app. Can anyone point me in the
right direction?

Documentation: http://packages.python.org/Flask-Sijax/

my blue print file:

group_mod = Blueprint('group_mod', __name__)

@flask_sijax.route(group_mod, "/sijax")
def sijax_test(obj_response):
    obj_response.alert('Hello. Sijax is working')

    if g.sijax.is_sijax_request:
        # The request looks like a valid Sijax request
        # Let's register the handlers and tell Sijax to process it
        g.sijax.register_callback('test', sijax_test)
        return g.sijax.process_request()



and the client side link:

<a href="javascript://"
onclick="Sijax.request('group_mod.sijax_test');">test</a>

I have also tried:

<a href="javascript://" onclick="Sijax.request('group_mod.test');">test</a>
<a href="javascript://" onclick="Sijax.request('test');">test</a> # this is
what the docs show for a single file app

Thanks!