librelist archives

« back to archive

OpenID and Flask

OpenID and Flask

From:
Armin Ronacher
Date:
2010-05-04 @ 13:48
Hi all,

There is a new example of how to do OpenID with Flask in the example 
section of the repository: http://bit.ly/dgpv5U

The interesting bit is the simpleopenid.py file that bridges Flask and 
python-openid.  Right now that is part of that repo and not too 
flexible, but easy to use.  If anyone is interested in that I would love 
to publish it on PyPI as reusable component.  In that case a Flask 
application would just have to do something like that:

     from flaskext.simpleopenid import SimpleOpenID
     oid = SimpleOpenID('/path/to/store')

And then register a loginhandler, a after_login function and you're 
mostly done.  Check out the linked example code above.

For things that are larger than a snippet and reusable I was thinking 
about a "flaskext" namespace package where everyone can drop stuff in. 
That way one can name the PyPI packages flaskext.name instead of 
flask_name which is probably nicer and easier to organize.  That's also 
what Sphinx, mercurial and trac are doing for plugins currently.

Let me know what you think about that, and if it makes sense to convert 
that simpleopenid.py into a standalone libary.


Regards,
Armin

Re: [flask] OpenID and Flask

From:
Armin Ronacher
Date:
2010-05-06 @ 11:31
Hi,

On 5/4/10 3:48 PM, Armin Ronacher wrote:
> Let me know what you think about that, and if it makes sense to convert
> that simpleopenid.py into a standalone libary.
I just went ahead and did exactly that now as proof of concept for 
reusable libraries on top of Flask:

- http://packages.python.org/Flask-OpenID/
- http://github.com/mitsuhiko/flask-openid/

Once we have some more libraries I will add a section to the website to 
enlist addon libraries for Flask.

An example of how to use that OpenID library is in the repository as 
well.  This is also the first library I know that registers as 
"flaskext.LIBNAME".


Regards,
Armin

Re: [flask] OpenID and Flask

From:
Dan Jacob
Date:
2010-05-06 @ 11:55
Great stuff, look forward to using it.

Would it be a good idea to have an "Extensions" page in the Flask site
with a list of flaskext libraries, plus how to add a new library to
flaskext (using the pkg_resources trick etc) ?

Entries could include an introduction, link to
github/google/bitbucket, compatibility(0.2 for example) and comments.

On 6 May 2010 12:31, Armin Ronacher <armin.ronacher@active-4.com> wrote:
> Hi,
>
> On 5/4/10 3:48 PM, Armin Ronacher wrote:
>> Let me know what you think about that, and if it makes sense to convert
>> that simpleopenid.py into a standalone libary.
> I just went ahead and did exactly that now as proof of concept for
> reusable libraries on top of Flask:
>
> - http://packages.python.org/Flask-OpenID/
> - http://github.com/mitsuhiko/flask-openid/
>
> Once we have some more libraries I will add a section to the website to
> enlist addon libraries for Flask.
>
> An example of how to use that OpenID library is in the repository as
> well.  This is also the first library I know that registers as
> "flaskext.LIBNAME".
>
>
> Regards,
> Armin
>

Re: [flask] OpenID and Flask

From:
Armin Ronacher
Date:
2010-05-06 @ 14:28
Hi,

On 2010-05-06 1:55 PM, Dan Jacob wrote:
> Would it be a good idea to have an "Extensions" page in the Flask site
> with a list of flaskext libraries, plus how to add a new library to
> flaskext (using the pkg_resources trick etc) ?
That's the plan.  But that list would be moderated by someone.  Because 
I only want modules listed there that are following some basic rules 
(inside the flaskext namespace, linked documentation etc.).

Ideally there would be a flaskext template that has a theme there for 
the documentation with intersphinx configured to flask, stdlib, 
werkzeug, Jinja2 and a setup.py file to get started.


Regards,
Armin

Re: [flask] OpenID and Flask

From:
Dan Jacob
Date:
2010-05-06 @ 14:43
> Ideally there would be a flaskext template that has a theme there for
> the documentation with intersphinx configured to flask, stdlib,
> werkzeug, Jinja2 and a setup.py file to get started.
>

A paster template might be good for this, if you don't mind paster.
Then you could just do "paster create -t flaskext_template myproject"
to get started.