From 8ad519922fa6626144c715bd53d84fa0ffe6a302 Mon Sep 17 00:00:00 2001 From: Chris Seymour <chris.j.seymour@hotmail.com> Date: Thu, 14 Aug 2014 22:03:43 +0100 Subject: [PATCH] Use a python code block for syntax rendering --- README.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 33b0eca..673b7be 100644 --- a/README.md +++ b/README.md @@ -19,21 +19,22 @@ with and tested on Python 2.6 and 2.7. Next, add a ``LDAP`` instance to your code and at least the three required configuration options: - from flask import Flask - from flask.ext.simpleldap import LDAP - - app = Flask(__name__) - ldap = LDAP(app) - - app.config['LDAP_BASE_DN'] = 'OU=users,dc=example,dc=org' - app.config['LDAP_USERNAME'] = 'CN=user,OU=Users,DC=example,DC=org' - app.config['LDAP_PASSWORD'] = 'password' - - @app.route('/ldap') - @ldap.login_required - def ldap_protected(): - return 'Success!' - +```python +from flask import Flask +from flask.ext.simpleldap import LDAP + +app = Flask(__name__) +ldap = LDAP(app) + +app.config['LDAP_BASE_DN'] = 'OU=users,dc=example,dc=org' +app.config['LDAP_USERNAME'] = 'CN=user,OU=Users,DC=example,DC=org' +app.config['LDAP_PASSWORD'] = 'password' + +@app.route('/ldap') +@ldap.login_required +def ldap_protected(): + return 'Success!' +``` Check the [examples](examples/) folder for a more complex example using LDAP groups. -- GitLab