Skip to content

Commit 79a5d10

Browse files
committed
fixing sortorder on flask examples
1 parent 443a71b commit 79a5d10

23 files changed

+1295
-53
lines changed

content/pages/examples/flask/flask-blueprints-blueprint.markdown

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,79 @@ def about():
270270
```
271271
272272
273-
## Example 4 from flask_jsondash
273+
## Example 4 from flask-debugtoolbar
274+
[Flask Debug-toolbar](https://github.com/flask-debugtoolbar/flask-debugtoolbar)
275+
([documentation](https://flask-debugtoolbar.readthedocs.io/en/latest/)
276+
and
277+
[PyPI page](https://pypi.org/project/Flask-DebugToolbar/))
278+
is a [Flask](/flask.html) conversion of the popular
279+
[Django Debug Toolbar](https://github.com/jazzband/django-debug-toolbar)
280+
project. This extension creates a sidebar with useful debugging
281+
information when you are running a Flask application in development
282+
mode. The project is provided as open source under
283+
[this license](https://github.com/flask-debugtoolbar/flask-debugtoolbar/blob/master/LICENSE).
284+
285+
[**flask-debugtoolbar / flask_debugtoolbar / __init__.py**](https://github.com/flask-debugtoolbar/flask-debugtoolbar/blob/master/flask_debugtoolbar/./__init__.py)
286+
287+
```python
288+
# __init__.py
289+
import os
290+
import warnings
291+
292+
~~from flask import Blueprint, current_app, request, g, send_from_directory, url_for
293+
from flask.globals import _request_ctx_stack
294+
from jinja2 import Environment, PackageLoader
295+
from werkzeug.urls import url_quote_plus
296+
297+
from flask_debugtoolbar.compat import iteritems
298+
from flask_debugtoolbar.toolbar import DebugToolbar
299+
from flask_debugtoolbar.utils import decode_text
300+
301+
try:
302+
# Python 3.8+
303+
from importlib.metadata import version
304+
305+
__version__ = version("Flask-DebugToolbar")
306+
except ImportError:
307+
import pkg_resources
308+
309+
__version__ = pkg_resources.get_distribution("Flask-DebugToolbar").version
310+
311+
312+
~~module = Blueprint('debugtoolbar', __name__)
313+
314+
315+
def replace_insensitive(string, target, replacement):
316+
"""Similar to string.replace() but is case insensitive
317+
Code borrowed from:
318+
http://forums.devshed.com/python-programming-11/case-insensitive-string-replace-490921.html
319+
"""
320+
no_case = string.lower()
321+
index = no_case.rfind(target.lower())
322+
if index >= 0:
323+
return string[:index] + replacement + string[index + len(target):]
324+
else: # no results so return the original string
325+
return string
326+
327+
328+
def _printable(value):
329+
try:
330+
return decode_text(repr(value))
331+
except Exception as e:
332+
return '<repr(%s) raised %s: %s>' % (
333+
object.__repr__(value), type(e).__name__, e)
334+
335+
336+
class DebugToolbarExtension(object):
337+
338+
339+
## ... source file continues with no further Blueprint examples...
340+
341+
342+
```
343+
344+
345+
## Example 5 from flask_jsondash
274346
[Flask JSONDash](https://github.com/christabor/flask_jsondash) is a
275347
configurable web application built in Flask that creates charts and
276348
dashboards from arbitrary API endpoints. Everything for the web app
@@ -356,7 +428,7 @@ def auth(**kwargs):
356428
```
357429
358430
359-
## Example 5 from flask-restx
431+
## Example 6 from flask-restx
360432
[Flask RESTX](https://github.com/python-restx/flask-restx) is an
361433
extension that makes it easier to build
362434
[RESTful APIs](/application-programming-interfaces.html) into
@@ -410,7 +482,7 @@ apidoc = Apidoc(
410482
```
411483
412484
413-
## Example 6 from Flask-WTF
485+
## Example 7 from Flask-WTF
414486
[Flask-WTF](https://github.com/lepture/flask-wtf)
415487
([project documentation](https://flask-wtf.readthedocs.io/en/stable/)
416488
and
@@ -519,7 +591,7 @@ def generate_csrf(secret_key=None, token_key=None):
519591
```
520592

521593

522-
## Example 7 from flaskSaaS
594+
## Example 8 from flaskSaaS
523595
[flaskSaas](https://github.com/alectrocute/flaskSaaS) is a boilerplate
524596
starter project to build a software-as-a-service (SaaS) web application
525597
in [Flask](/flask.html), with [Stripe](/stripe.html) for billing. The
@@ -590,7 +662,7 @@ def signup():
590662
```
591663

592664

593-
## Example 8 from tedivms-flask
665+
## Example 9 from tedivms-flask
594666
[tedivm's flask starter app](https://github.com/tedivm/tedivms-flask) is a
595667
base of [Flask](/flask.html) code and related projects such as
596668
[Celery](/celery.html) which provides a template to start your own

content/pages/examples/flask/flask-cli-flaskgroup.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
title: flask.cli FlaskGroup code examples
22
category: page
33
slug: flask-cli-flaskgroup-examples
4-
sortorder: 500021000
4+
sortorder: 500021001
55
toc: False
66
sidebartitle: flask.cli FlaskGroup
77
meta: Python example code for the FlaskGroup class from the flask.cli module of the Flask project.

content/pages/examples/flask/flask-cli-scriptinfo.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
title: flask.cli ScriptInfo code examples
22
category: page
33
slug: flask-cli-scriptinfo-examples
4-
sortorder: 500021001
4+
sortorder: 500021002
55
toc: False
66
sidebartitle: flask.cli ScriptInfo
77
meta: Python example code for the ScriptInfo class from the flask.cli module of the Flask project.

content/pages/examples/flask/flask-cli-with-appcontext.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
title: flask.cli with_appcontext code examples
22
category: page
33
slug: flask-cli-with-appcontext-examples
4-
sortorder: 500021002
4+
sortorder: 500021003
55
toc: False
66
sidebartitle: flask.cli with_appcontext
77
meta: Python example code for the with_appcontext function from the flask.cli module of the Flask project.

content/pages/examples/flask/flask-ctx-has-app-context.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
title: flask.ctx has_app_context code examples
22
category: page
33
slug: flask-ctx-has-app-context-examples
4-
sortorder: 500021000
4+
sortorder: 500021004
55
toc: False
66
sidebartitle: flask.ctx has_app_context
77
meta: Python example code for the has_app_context function from the flask.ctx module of the Flask project.

content/pages/examples/flask/flask-ctx-has-request-context.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
title: flask.ctx has_request_context code examples
22
category: page
33
slug: flask-ctx-has-request-context-examples
4-
sortorder: 500021001
4+
sortorder: 500021005
55
toc: False
66
sidebartitle: flask.ctx has_request_context
77
meta: Python example code for the has_request_context function from the flask.ctx module of the Flask project.

content/pages/examples/flask/flask-extensions-plug-ins.markdown

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ flask-base's code is open sourced
6565
[under the MIT license](https://github.com/hack4impact/flask-base/blob/master/LICENSE.md).
6666

6767

68+
### Flask Debug-toolbar
69+
[Flask Debug-toolbar](https://github.com/flask-debugtoolbar/flask-debugtoolbar)
70+
([documentation](https://flask-debugtoolbar.readthedocs.io/en/latest/)
71+
and
72+
[PyPI page](https://pypi.org/project/Flask-DebugToolbar/))
73+
is a [Flask](/flask.html) conversion of the popular
74+
[Django Debug Toolbar](https://github.com/jazzband/django-debug-toolbar)
75+
project. This extension creates a sidebar with useful debugging
76+
information when you are running a Flask application in development
77+
mode. The project is provided as open source under
78+
[this license](https://github.com/flask-debugtoolbar/flask-debugtoolbar/blob/master/LICENSE).
79+
80+
6881
### Flask-Login
6982
[Flask-Login](https://github.com/maxcountryman/flask-login)
7083
([project documentation](https://flask-login.readthedocs.io/en/latest/)

0 commit comments

Comments
 (0)