./ 0000700 0000000 0000000 00000000000 12272231453 007700 5 ustar root root ./Flask-OpenID-1.2.1+dfsg/ 0000775 0000000 0000000 00000000000 12271202767 013451 5 ustar root root ./Flask-OpenID-1.2.1+dfsg/MANIFEST.in 0000664 0000000 0000000 00000000360 12266505343 015206 0 ustar root root include README LICENSE recursive-include docs * recursive-exclude docs *.pyc recursive-exclude docs *.pyo recursive-include example * recursive-exclude example *.pyc recursive-exclude example *.pyo prune docs/_build prune docs/_themes/.git ./Flask-OpenID-1.2.1+dfsg/example/ 0000775 0000000 0000000 00000000000 12271202767 015104 5 ustar root root ./Flask-OpenID-1.2.1+dfsg/example/example.py 0000664 0000000 0000000 00000013061 12266520237 017111 0 ustar root root # -*- coding: utf-8 -*- """ OpenID Example ~~~~~~~~~~~~~~ This simple application shows how to integrate OpenID in your application. This example requires SQLAlchemy as a dependency. :copyright: (c) 2010 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from flask import Flask, render_template, request, g, session, flash, \ redirect, url_for, abort from flask.ext.openid import OpenID from openid.extensions import pape from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext.declarative import declarative_base # setup flask app = Flask(__name__) app.config.update( DATABASE_URI = 'sqlite:////tmp/flask-openid.db', SECRET_KEY = 'development key', DEBUG = True ) # setup flask-openid oid = OpenID(app, safe_roots=[], extension_responses=[pape.Response]) # setup sqlalchemy engine = create_engine(app.config['DATABASE_URI']) db_session = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine)) Base = declarative_base() Base.query = db_session.query_property() def init_db(): Base.metadata.create_all(bind=engine) class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String(60)) email = Column(String(200)) openid = Column(String(200)) def __init__(self, name, email, openid): self.name = name self.email = email self.openid = openid @app.before_request def before_request(): g.user = None if 'openid' in session: g.user = User.query.filter_by(openid=session['openid']).first() @app.after_request def after_request(response): db_session.remove() return response @app.route('/') def index(): return render_template('index.html') @app.route('/login', methods=['GET', 'POST']) @oid.loginhandler def login(): """Does the login via OpenID. Has to call into `oid.try_login` to start the OpenID machinery. """ # if we are already logged in, go back to were we came from if g.user is not None: return redirect(oid.get_next_url()) if request.method == 'POST': openid = request.form.get('openid') if openid: pape_req = pape.Request([]) return oid.try_login(openid, ask_for=['email', 'nickname'], ask_for_optional=['fullname'], extensions=[pape_req]) return render_template('login.html', next=oid.get_next_url(), error=oid.fetch_error()) @oid.after_login def create_or_login(resp): """This is called when login with OpenID succeeded and it's not necessary to figure out if this is the users's first login or not. This function has to redirect otherwise the user will be presented with a terrible URL which we certainly don't want. """ session['openid'] = resp.identity_url if 'pape' in resp.extensions: pape_resp = resp.extensions['pape'] session['auth_time'] = pape_resp.auth_time user = User.query.filter_by(openid=resp.identity_url).first() if user is not None: flash(u'Successfully signed in') g.user = user return redirect(oid.get_next_url()) return redirect(url_for('create_profile', next=oid.get_next_url(), name=resp.fullname or resp.nickname, email=resp.email)) @app.route('/create-profile', methods=['GET', 'POST']) def create_profile(): """If this is the user's first login, the create_or_login function will redirect here so that the user can set up his profile. """ if g.user is not None or 'openid' not in session: return redirect(url_for('index')) if request.method == 'POST': name = request.form['name'] email = request.form['email'] if not name: flash(u'Error: you have to provide a name') elif '@' not in email: flash(u'Error: you have to enter a valid email address') else: flash(u'Profile successfully created') db_session.add(User(name, email, session['openid'])) db_session.commit() return redirect(oid.get_next_url()) return render_template('create_profile.html', next_url=oid.get_next_url()) @app.route('/profile', methods=['GET', 'POST']) def edit_profile(): """Updates a profile""" if g.user is None: abort(401) form = dict(name=g.user.name, email=g.user.email) if request.method == 'POST': if 'delete' in request.form: db_session.delete(g.user) db_session.commit() session['openid'] = None flash(u'Profile deleted') return redirect(url_for('index')) form['name'] = request.form['name'] form['email'] = request.form['email'] if not form['name']: flash(u'Error: you have to provide a name') elif '@' not in form['email']: flash(u'Error: you have to enter a valid email address') else: flash(u'Profile successfully created') g.user.name = form['name'] g.user.email = form['email'] db_session.commit() return redirect(url_for('edit_profile')) return render_template('edit_profile.html', form=form) @app.route('/logout') def logout(): session.pop('openid', None) flash(u'You have been signed out') return redirect(oid.get_next_url()) if __name__ == '__main__': app.run() ./Flask-OpenID-1.2.1+dfsg/example/templates/ 0000775 0000000 0000000 00000000000 12271202767 017102 5 ustar root root ./Flask-OpenID-1.2.1+dfsg/example/templates/index.html 0000664 0000000 0000000 00000000325 12266505343 021077 0 ustar root root {% extends "layout.html" %} {% block body %}
Hello {{ g.user.name }}! {% endif %}
This is just an example page so that something is here. {% endblock %} ./Flask-OpenID-1.2.1+dfsg/example/templates/login.html 0000664 0000000 0000000 00000000626 12266505343 021104 0 ustar root root {% extends "layout.html" %} {% block title %}Sign in{% endblock %} {% block body %}
Hey! This is the first time you signed in on this website. In order to proceed we need some extra information from you:
If you don't want to proceed, you can sign out again. {% endblock %} ./Flask-OpenID-1.2.1+dfsg/example/templates/layout.html 0000664 0000000 0000000 00000001202 12266505343 021300 0 ustar root root
Hey! This is the first time you signed in on this website. In order to proceed we need a couple of more information from you:
If you don't want to proceed, you can sign out again.
{% endblock %}
Logging Out
-----------
The logout function is very simple, it just has to unset the openid from
the session and redirect back to where the user was before::
@app.route('/logout')
def logout():
session.pop('openid', None)
flash(u'You were signed out')
return redirect(oid.get_next_url())
Advanced usage
--------------
Flask-OpenID can also work with any python-openid extension.
To use this, pass a list of instantiated request openid.extension.Extension
objects in the `extensions` field of :meth:`~OpenID.try_login`.
The responses of these extensions are available during the :meth:`after_login`
function, as entries in resp.extensions.
Full Example
------------
To see the full code of that example, you can download the code `from
github
{% endif %}
{% endblock %}
{% block sidebar1 %}{% endblock %}
{% block sidebar2 %}{% endblock %}
./Flask-OpenID-1.2.1+dfsg/docs/_themes/flask_small/theme.conf 0000664 0000000 0000000 00000000270 12266506625 022271 0 ustar root root [theme]
inherit = basic
stylesheet = flasky.css
nosidebar = true
pygments_style = flask_theme_support.FlaskyStyle
[options]
index_logo = ''
index_logo_height = 120px
github_fork = ''
./Flask-OpenID-1.2.1+dfsg/docs/_themes/.git 0000664 0000000 0000000 00000000050 12266506625 016610 0 ustar root root gitdir: ../../.git/modules/docs/_themes
./Flask-OpenID-1.2.1+dfsg/docs/_themes/.gitignore 0000664 0000000 0000000 00000000026 12266506625 020017 0 ustar root root *.pyc
*.pyo
.DS_Store
./Flask-OpenID-1.2.1+dfsg/docs/_themes/README 0000664 0000000 0000000 00000002105 12266506625 016707 0 ustar root root Flask Sphinx Styles
===================
This repository contains sphinx styles for Flask and Flask related
projects. To use this style in your Sphinx documentation, follow
this guide:
1. put this folder as _themes into your docs folder. Alternatively
you can also use git submodules to check out the contents there.
2. add this to your conf.py:
sys.path.append(os.path.abspath('_themes'))
html_theme_path = ['_themes']
html_theme = 'flask'
The following themes exist:
- 'flask' - the standard flask documentation theme for large
projects
- 'flask_small' - small one-page theme. Intended to be used by
very small addon libraries for flask.
The following options exist for the flask_small theme:
[options]
index_logo = '' filename of a picture in _static
to be used as replacement for the
h1 in the index.rst file.
index_logo_height = 120px height of the index logo
github_fork = '' repository name on github for the
"fork me" badge
./Flask-OpenID-1.2.1+dfsg/docs/_themes/flask/ 0000775 0000000 0000000 00000000000 12271202767 017125 5 ustar root root ./Flask-OpenID-1.2.1+dfsg/docs/_themes/flask/static/ 0000775 0000000 0000000 00000000000 12271202767 020414 5 ustar root root ./Flask-OpenID-1.2.1+dfsg/docs/_themes/flask/static/small_flask.css 0000664 0000000 0000000 00000001720 12266506625 023422 0 ustar root root /*
* small_flask.css_t
* ~~~~~~~~~~~~~~~~~
*
* :copyright: Copyright 2010 by Armin Ronacher.
* :license: Flask Design License, see LICENSE for details.
*/
body {
margin: 0;
padding: 20px 30px;
}
div.documentwrapper {
float: none;
background: white;
}
div.sphinxsidebar {
display: block;
float: none;
width: 102.5%;
margin: 50px -30px -20px -30px;
padding: 10px 20px;
background: #333;
color: white;
}
div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
div.sphinxsidebar h3 a {
color: white;
}
div.sphinxsidebar a {
color: #aaa;
}
div.sphinxsidebar p.logo {
display: none;
}
div.document {
width: 100%;
margin: 0;
}
div.related {
display: block;
margin: 0;
padding: 10px 0 20px 0;
}
div.related ul,
div.related ul li {
margin: 0;
padding: 0;
}
div.footer {
display: none;
}
div.bodywrapper {
margin: 0;
}
div.body {
min-height: 0;
padding: 0;
}
./Flask-OpenID-1.2.1+dfsg/docs/_themes/flask/static/flasky.css_t 0000664 0000000 0000000 00000014131 12266506625 022746 0 ustar root root /*
* flasky.css_t
* ~~~~~~~~~~~~
*
* :copyright: Copyright 2010 by Armin Ronacher.
* :license: Flask Design License, see LICENSE for details.
*/
{% set page_width = '940px' %}
{% set sidebar_width = '220px' %}
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: 'Georgia', serif;
font-size: 17px;
background-color: white;
color: #000;
margin: 0;
padding: 0;
}
div.document {
width: {{ page_width }};
margin: 30px auto 0 auto;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 {{ sidebar_width }};
}
div.sphinxsidebar {
width: {{ sidebar_width }};
}
hr {
border: 1px solid #B1B4B6;
}
div.body {
background-color: #ffffff;
color: #3E4349;
padding: 0 30px 0 30px;
}
img.floatingflask {
padding: 0 0 10px 10px;
float: right;
}
div.footer {
width: {{ page_width }};
margin: 20px auto 30px auto;
font-size: 14px;
color: #888;
text-align: right;
}
div.footer a {
color: #888;
}
div.related {
display: none;
}
div.sphinxsidebar a {
color: #444;
text-decoration: none;
border-bottom: 1px dotted #999;
}
div.sphinxsidebar a:hover {
border-bottom: 1px solid #999;
}
div.sphinxsidebar {
font-size: 14px;
line-height: 1.5;
}
div.sphinxsidebarwrapper {
padding: 18px 10px;
}
div.sphinxsidebarwrapper p.logo {
padding: 0 0 20px 0;
margin: 0;
text-align: center;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: 'Garamond', 'Georgia', serif;
color: #444;
font-size: 24px;
font-weight: normal;
margin: 0 0 5px 0;
padding: 0;
}
div.sphinxsidebar h4 {
font-size: 20px;
}
div.sphinxsidebar h3 a {
color: #444;
}
div.sphinxsidebar p.logo a,
div.sphinxsidebar h3 a,
div.sphinxsidebar p.logo a:hover,
div.sphinxsidebar h3 a:hover {
border: none;
}
div.sphinxsidebar p {
color: #555;
margin: 10px 0;
}
div.sphinxsidebar ul {
margin: 10px 0;
padding: 0;
color: #000;
}
div.sphinxsidebar input {
border: 1px solid #ccc;
font-family: 'Georgia', serif;
font-size: 1em;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: #004B6B;
text-decoration: underline;
}
a:hover {
color: #6D4100;
text-decoration: underline;
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
margin: 30px 0px 10px 0px;
padding: 0;
}
div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #ddd;
padding: 0 4px;
text-decoration: none;
}
a.headerlink:hover {
color: #444;
background: #eaeaea;
}
div.body p, div.body dd, div.body li {
line-height: 1.4em;
}
div.admonition {
background: #fafafa;
margin: 20px -30px;
padding: 10px 30px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
div.admonition tt.xref, div.admonition a tt {
border-bottom: 1px solid #fafafa;
}
dd div.admonition {
margin-left: -60px;
padding-left: 60px;
}
div.admonition p.admonition-title {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
font-size: 24px;
margin: 0 0 10px 0;
padding: 0;
line-height: 1;
}
div.admonition p.last {
margin-bottom: 0;
}
div.highlight {
background-color: white;
}
dt:target, .highlight {
background: #FAF3E8;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre, tt {
font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
font-size: 0.9em;
}
img.screenshot {
}
tt.descname, tt.descclassname {
font-size: 0.95em;
}
tt.descname {
padding-right: 0.08em;
}
img.screenshot {
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils {
border: 1px solid #888;
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils td, table.docutils th {
border: 1px solid #888;
padding: 0.25em 0.7em;
}
table.field-list, table.footnote {
border: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
table.footnote {
margin: 15px 0;
width: 100%;
border: 1px solid #eee;
background: #fdfdfd;
font-size: 0.9em;
}
table.footnote + table.footnote {
margin-top: -15px;
border-top: none;
}
table.field-list th {
padding: 0 0.8em 0 0;
}
table.field-list td {
padding: 0;
}
table.footnote td.label {
width: 0px;
padding: 0.3em 0 0.3em 0.5em;
}
table.footnote td {
padding: 0.3em 0.5em;
}
dl {
margin: 0;
padding: 0;
}
dl dd {
margin-left: 30px;
}
blockquote {
margin: 0 0 0 30px;
padding: 0;
}
ul, ol {
margin: 10px 0 10px 30px;
padding: 0;
}
pre {
background: #eee;
padding: 7px 30px;
margin: 15px -30px;
line-height: 1.3em;
}
dl pre, blockquote pre, li pre {
margin-left: -60px;
padding-left: 60px;
}
dl dl pre {
margin-left: -90px;
padding-left: 90px;
}
tt {
background-color: #ecf0f3;
color: #222;
/* padding: 1px 2px; */
}
tt.xref, a tt {
background-color: #FBFBFB;
border-bottom: 1px solid white;
}
a.reference {
text-decoration: none;
border-bottom: 1px dotted #004B6B;
}
a.reference:hover {
border-bottom: 1px solid #6D4100;
}
a.footnote-reference {
text-decoration: none;
font-size: 0.7em;
vertical-align: top;
border-bottom: 1px dotted #004B6B;
}
a.footnote-reference:hover {
border-bottom: 1px solid #6D4100;
}
a:hover tt {
background: #EEE;
}
./Flask-OpenID-1.2.1+dfsg/docs/_themes/flask/relations.html 0000664 0000000 0000000 00000001116 12266506625 022016 0 ustar root root
Related Topics
./Flask-OpenID-1.2.1+dfsg/docs/_themes/flask/layout.html 0000664 0000000 0000000 00000001106 12266506625 021332 0 ustar root root {%- extends "basic/layout.html" %}
{%- block extrahead %}
{{ super() }}
{% if theme_touch_icon %}
{% endif %}
{% endblock %}
{%- block relbar2 %}{% endblock %}
{%- block footer %}
{%- endblock %}
./Flask-OpenID-1.2.1+dfsg/docs/_themes/flask/theme.conf 0000664 0000000 0000000 00000000172 12266506625 021102 0 ustar root root [theme]
inherit = basic
stylesheet = flasky.css
pygments_style = flask_theme_support.FlaskyStyle
[options]
touch_icon =
./Flask-OpenID-1.2.1+dfsg/docs/_themes/flask_theme_support.py 0000664 0000000 0000000 00000011413 12266506625 022461 0 ustar root root # flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = ""
styles = {
# No corresponding class for the following:
#Text: "", # class: ''
Whitespace: "underline #f8f8f8", # class: 'w'
Error: "#a40000 border:#ef2929", # class: 'err'
Other: "#000000", # class 'x'
Comment: "italic #8f5902", # class: 'c'
Comment.Preproc: "noitalic", # class: 'cp'
Keyword: "bold #004461", # class: 'k'
Keyword.Constant: "bold #004461", # class: 'kc'
Keyword.Declaration: "bold #004461", # class: 'kd'
Keyword.Namespace: "bold #004461", # class: 'kn'
Keyword.Pseudo: "bold #004461", # class: 'kp'
Keyword.Reserved: "bold #004461", # class: 'kr'
Keyword.Type: "bold #004461", # class: 'kt'
Operator: "#582800", # class: 'o'
Operator.Word: "bold #004461", # class: 'ow' - like keywords
Punctuation: "bold #000000", # class: 'p'
# because special names such as Name.Class, Name.Function, etc.
# are not recognized as such later in the parsing, we choose them
# to look the same as ordinary variables.
Name: "#000000", # class: 'n'
Name.Attribute: "#c4a000", # class: 'na' - to be revised
Name.Builtin: "#004461", # class: 'nb'
Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
Name.Class: "#000000", # class: 'nc' - to be revised
Name.Constant: "#000000", # class: 'no' - to be revised
Name.Decorator: "#888", # class: 'nd' - to be revised
Name.Entity: "#ce5c00", # class: 'ni'
Name.Exception: "bold #cc0000", # class: 'ne'
Name.Function: "#000000", # class: 'nf'
Name.Property: "#000000", # class: 'py'
Name.Label: "#f57900", # class: 'nl'
Name.Namespace: "#000000", # class: 'nn' - to be revised
Name.Other: "#000000", # class: 'nx'
Name.Tag: "bold #004461", # class: 'nt' - like a keyword
Name.Variable: "#000000", # class: 'nv' - to be revised
Name.Variable.Class: "#000000", # class: 'vc' - to be revised
Name.Variable.Global: "#000000", # class: 'vg' - to be revised
Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
Number: "#990000", # class: 'm'
Literal: "#000000", # class: 'l'
Literal.Date: "#000000", # class: 'ld'
String: "#4e9a06", # class: 's'
String.Backtick: "#4e9a06", # class: 'sb'
String.Char: "#4e9a06", # class: 'sc'
String.Doc: "italic #8f5902", # class: 'sd' - like a comment
String.Double: "#4e9a06", # class: 's2'
String.Escape: "#4e9a06", # class: 'se'
String.Heredoc: "#4e9a06", # class: 'sh'
String.Interpol: "#4e9a06", # class: 'si'
String.Other: "#4e9a06", # class: 'sx'
String.Regex: "#4e9a06", # class: 'sr'
String.Single: "#4e9a06", # class: 's1'
String.Symbol: "#4e9a06", # class: 'ss'
Generic: "#000000", # class: 'g'
Generic.Deleted: "#a40000", # class: 'gd'
Generic.Emph: "italic #000000", # class: 'ge'
Generic.Error: "#ef2929", # class: 'gr'
Generic.Heading: "bold #000080", # class: 'gh'
Generic.Inserted: "#00A000", # class: 'gi'
Generic.Output: "#888", # class: 'go'
Generic.Prompt: "#745334", # class: 'gp'
Generic.Strong: "bold #000000", # class: 'gs'
Generic.Subheading: "bold #800080", # class: 'gu'
Generic.Traceback: "bold #a40000", # class: 'gt'
}
./Flask-OpenID-1.2.1+dfsg/docs/_static/ 0000775 0000000 0000000 00000000000 12271202767 016027 5 ustar root root ./Flask-OpenID-1.2.1+dfsg/docs/_static/flask-openid.png 0000664 0000000 0000000 00000033004 12266505343 021111 0 ustar root root PNG
IHDR b 5+v sBIT|d pHYs a(a tEXtSoftware www.inkscape.org< IDATxy]?߈"!1ER,yfZ5LR3EҚfZCs1&]'ws>>ýYϽwk>kef̨HZ8̶ku_"H$i'z@ d`}`f6݊D"Hm4I cՀZکH$DڌF i!@`3{'7``+D"H5zK:x̦ zsD"HzA+UlBiF"H$D$N0\H$DQZT`
fjx"H$F
Y3U*.qR$D"#&FIZQU
!D""AҏB$D" z88 j"H$)'Ly8F'H$D5H$&
{%- for parent in parents %}
{%- endfor %}
{%- if prev %}