fedora-infra / flask-oidc

OpenID Connect support for Flask
21 stars 14 forks source link

Documentation code uses undefined variable `g` #88

Open joostrijneveld opened 4 days ago

joostrijneveld commented 4 days ago

The README contains the following text fragment:

A :class:~flask_oidc.model.User object is also provided on g.oidc_user, see its API documentation to discover which convenient properties are available.

However, g is never defined.

Similarly, the code snippet uses g as if it were a global, but I find no references to it.

@app.route('/alt')
def alternative():
    # This uses the user instance at g.oidc_user instead
    if g.oidc_user.logged_in:
        return 'Welcome %s' % g.oidc_user.profile.get('email')
    else
        return 'Not logged in'

Where does this variable come from?

joostrijneveld commented 3 days ago

It appears this is to be imported from flask, i.e., from flask import Flask, g, session