Skip to content

Commit b66c41a

Browse files
authored
Merge branch 'main' into bootstrap535
2 parents a0fc3ef + 66a44ff commit b66c41a

File tree

13 files changed

+41
-28
lines changed

13 files changed

+41
-28
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
matrix:
2424
os: [ubuntu-latest, macos-latest, windows-latest]
25-
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
25+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
2626
fail-fast: false
2727
runs-on: ${{ matrix.os }}
2828
steps:

examples/bootstrap4/app.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from flask_wtf import FlaskForm, CSRFProtect
66
from wtforms.validators import DataRequired, Length, Regexp
77
from wtforms.fields import *
8-
from flask_bootstrap import Bootstrap4, SwitchField
98
from flask_sqlalchemy import SQLAlchemy
9+
from flask_bootstrap import Bootstrap4, SwitchField
1010

1111
app = Flask(__name__)
1212
app.secret_key = 'dev'
@@ -34,6 +34,7 @@
3434

3535
class ExampleForm(FlaskForm):
3636
"""An example form that contains all the supported bootstrap style form fields."""
37+
3738
date = DateField(description="We'll never share your email with anyone else.") # add help text with `description`
3839
datetime = DateTimeField(render_kw={'placeholder': 'this is a placeholder'}) # add HTML attribute with `render_kw`
3940
datetime_local = DateTimeLocalField()
@@ -52,8 +53,8 @@ class ExampleForm(FlaskForm):
5253
select = SelectField(choices=[('dog', 'Dog'), ('cat', 'Cat'), ('bird', 'Bird'), ('alien', 'Alien')])
5354
select_multiple = SelectMultipleField(choices=[('dog', 'Dog'), ('cat', 'Cat'), ('bird', 'Bird'), ('alien', 'Alien')])
5455
bio = TextAreaField()
55-
search = SearchField() # will autocapitalize on mobile
56-
title = StringField() # will not autocapitalize on mobile
56+
search = SearchField() # will autocapitalize on mobile
57+
title = StringField() # will not autocapitalize on mobile
5758
secret = PasswordField()
5859
remember = BooleanField('Remember me')
5960
submit = SubmitField()
@@ -96,7 +97,8 @@ class ContactForm(FlaskForm):
9697

9798
class BootswatchForm(FlaskForm):
9899
"""Form to test Bootswatch."""
99-
#DO NOT EDIT! Use list-bootswatch.py to generate the Radiofield below.
100+
101+
# DO NOT EDIT! Use list-bootswatch.py to generate the Radiofield below.
100102
theme_name = RadioField(
101103
default='default',
102104
choices=[
@@ -208,7 +210,7 @@ def test_bootswatch():
208210
app.config['BOOTSTRAP_BOOTSWATCH_THEME'] = form.theme_name.data
209211
flash(f'Render style has been set to {form.theme_name.data}.')
210212
else:
211-
if app.config['BOOTSTRAP_BOOTSWATCH_THEME'] != None:
213+
if app.config['BOOTSTRAP_BOOTSWATCH_THEME'] is not None:
212214
form.theme_name.data = app.config['BOOTSTRAP_BOOTSWATCH_THEME']
213215
return render_template('bootswatch.html', form=form)
214216

examples/bootstrap5/app.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from flask_wtf import FlaskForm, CSRFProtect
66
from wtforms.validators import DataRequired, Length, Regexp
77
from wtforms.fields import *
8-
from flask_bootstrap import Bootstrap5, SwitchField
98
from flask_sqlalchemy import SQLAlchemy
9+
from flask_bootstrap import Bootstrap5, SwitchField
1010

1111
app = Flask(__name__)
1212
app.secret_key = 'dev'
@@ -34,6 +34,7 @@
3434

3535
class ExampleForm(FlaskForm):
3636
"""An example form that contains all the supported bootstrap style form fields."""
37+
3738
date = DateField(description="We'll never share your email with anyone else.") # add help text with `description`
3839
datetime = DateTimeField(render_kw={'placeholder': 'this is a placeholder'}) # add HTML attribute with `render_kw`
3940
datetime_local = DateTimeLocalField()
@@ -52,8 +53,8 @@ class ExampleForm(FlaskForm):
5253
select = SelectField(choices=[('dog', 'Dog'), ('cat', 'Cat'), ('bird', 'Bird'), ('alien', 'Alien')])
5354
select_multiple = SelectMultipleField(choices=[('dog', 'Dog'), ('cat', 'Cat'), ('bird', 'Bird'), ('alien', 'Alien')])
5455
bio = TextAreaField()
55-
search = SearchField() # will autocapitalize on mobile
56-
title = StringField() # will not autocapitalize on mobile
56+
search = SearchField() # will autocapitalize on mobile
57+
title = StringField() # will not autocapitalize on mobile
5758
secret = PasswordField()
5859
remember = BooleanField('Remember me')
5960
submit = SubmitField()
@@ -96,7 +97,8 @@ class ContactForm(FlaskForm):
9697

9798
class BootswatchForm(FlaskForm):
9899
"""Form to test Bootswatch."""
99-
#DO NOT EDIT! Use list-bootswatch.py to generate the Radiofield below.
100+
101+
# DO NOT EDIT! Use list-bootswatch.py to generate the Radiofield below.
100102
theme_name = RadioField(
101103
default='default',
102104
choices=[
@@ -213,7 +215,7 @@ def test_bootswatch():
213215
app.config['BOOTSTRAP_BOOTSWATCH_THEME'] = form.theme_name.data
214216
flash(f'Render style has been set to {form.theme_name.data}.')
215217
else:
216-
if app.config['BOOTSTRAP_BOOTSWATCH_THEME'] != None:
218+
if app.config['BOOTSTRAP_BOOTSWATCH_THEME'] is not None:
217219
form.theme_name.data = app.config['BOOTSTRAP_BOOTSWATCH_THEME']
218220
return render_template('bootswatch.html', form=form)
219221

flask_bootstrap/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def load_icon_font_css(self):
131131
"""
132132
serve_local = current_app.config['BOOTSTRAP_SERVE_LOCAL']
133133
if serve_local:
134-
icons_url = url_for('bootstrap.static', filename='font/bootstrap-icons.min.css')
134+
icons_url = url_for('bootstrap.static', filename='css/font/bootstrap-icons.min.css')
135135
else:
136136
icons_url = f'{CDN_BASE}/bootstrap-icons@{self.icons_version}/font/bootstrap-icons.min.css'
137137
css = f'<link rel="stylesheet" href="{icons_url}">'
@@ -239,6 +239,7 @@ def create_app():
239239
.. versionchanged:: 2.0.0
240240
Move common logic to base class ``_Bootstrap``.
241241
"""
242+
242243
bootstrap_version = '4.6.1'
243244
jquery_version = '3.5.1'
244245
popper_version = '1.16.1'

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ classifiers = [
1313
'Operating System :: OS Independent',
1414
'Programming Language :: Python',
1515
'Programming Language :: Python :: 3',
16-
'Programming Language :: Python :: 3.8',
1716
'Programming Language :: Python :: 3.9',
1817
'Programming Language :: Python :: 3.10',
1918
'Programming Language :: Python :: 3.11',
2019
'Programming Language :: Python :: 3.12',
20+
'Programming Language :: Python :: 3.13',
2121
'Framework :: Flask',
2222
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
2323
'Topic :: Software Development :: Libraries :: Python Modules',

tests/test_bootstrap4/test_bootstrap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def test_deprecate_bootstrap_class(self):
1515

1616
app = Flask(__name__)
1717
with pytest.warns(UserWarning):
18-
bootstrap = Bootstrap(app) # noqa: F841
18+
_ = Bootstrap(app)
1919

2020
def test_deprecate_bootstrap_template_path(self, app, client):
2121
@app.route('/test')
22-
def foo():
22+
def test_render_template_string():
2323
return render_template_string('''
2424
{% from 'bootstrap/utils.html' import render_icon %}
2525
{{ render_icon('heart') }}

tests/test_bootstrap4/test_render_breadcrumb_item.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33

44
def test_render_breadcrumb_item_active(app, client):
55
@app.route('/not_active_item')
6-
def foo():
6+
def item_foo():
77
return render_template_string('''
88
{% from 'bootstrap4/nav.html' import render_breadcrumb_item %}
9-
{{ render_breadcrumb_item('bar', 'Bar') }}
9+
{{ render_breadcrumb_item('item_bar', 'Bar') }}
1010
''')
1111

1212
@app.route('/active_item')
13-
def bar():
13+
def item_bar():
1414
return render_template_string('''
1515
{% from 'bootstrap4/nav.html' import render_breadcrumb_item %}
16-
{{ render_breadcrumb_item('bar', 'Bar') }}
16+
{{ render_breadcrumb_item('item_bar', 'Bar') }}
1717
''')
1818

1919
response = client.get('/not_active_item')

tests/test_bootstrap4/test_render_icon.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,18 @@ def test_render_icon_font_config(app, client):
154154
def icon():
155155
return render_template_string('''
156156
{% from 'bootstrap4/utils.html' import render_icon %}
157+
{{ bootstrap.load_icon_font_css() }}
157158
{{ render_icon('heart', font=True) }}
158159
''')
159160

160161
response = client.get('/icon')
161162
data = response.get_data(as_text=True)
162163
assert 'size: 100;' in data
163164
assert 'text-success' in data
165+
166+
# complete test coverage for bootstrap.load_icon_font_css()
167+
app.config['BOOTSTRAP_SERVE_LOCAL'] = not app.config['BOOTSTRAP_SERVE_LOCAL']
168+
response = client.get('/icon')
169+
data = response.get_data(as_text=True)
170+
assert 'size: 100;' in data
171+
assert 'text-success' in data

tests/test_bootstrap4/test_render_nav_item.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33

44
def test_render_nav_item_active(app, client):
55
@app.route('/active')
6-
def foo():
6+
def item_foo():
77
return render_template_string('''
88
{% from 'bootstrap4/nav.html' import render_nav_item %}
9-
{{ render_nav_item('foo', 'Foo') }}
9+
{{ render_nav_item('item_foo', 'Foo') }}
1010
''')
1111

1212
@app.route('/not_active')
13-
def bar():
13+
def item_bar():
1414
return render_template_string('''
1515
{% from 'bootstrap4/nav.html' import render_nav_item %}
16-
{{ render_nav_item('foo', 'Foo') }}
16+
{{ render_nav_item('item_foo', 'Foo') }}
1717
''')
1818

1919
response = client.get('/active')

tests/test_bootstrap4/test_render_pager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Message(db.Model):
1212
def test():
1313
db.drop_all()
1414
db.create_all()
15-
for i in range(100):
15+
for _ in range(100):
1616
msg = Message()
1717
db.session.add(msg)
1818
db.session.commit()

0 commit comments

Comments
 (0)