Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimum Python version #29

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exclude flask_talisman/talisman_test.py
26 changes: 5 additions & 21 deletions flask_talisman/talisman.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from collections import OrderedDict

import flask


Expand Down Expand Up @@ -143,20 +141,9 @@ def init_app(

See README.rst for a detailed description of each option.
"""
if isinstance(feature_policy, dict):
self.feature_policy = OrderedDict(feature_policy)
else:
self.feature_policy = feature_policy

if isinstance(permissions_policy, dict):
self.permissions_policy = OrderedDict(permissions_policy)
else:
self.permissions_policy = permissions_policy

if isinstance(document_policy, dict):
self.document_policy = OrderedDict(document_policy)
else:
self.document_policy = document_policy
self.feature_policy = feature_policy
self.permissions_policy = permissions_policy
self.document_policy = document_policy

self.force_https = force_https
self.force_https_permanent = force_https_permanent
Expand All @@ -172,10 +159,7 @@ def init_app(
self.strict_transport_security_include_subdomains = \
strict_transport_security_include_subdomains

if isinstance(content_security_policy, dict):
self.content_security_policy = OrderedDict(content_security_policy)
else:
self.content_security_policy = content_security_policy
self.content_security_policy = content_security_policy
self.content_security_policy_report_uri = \
content_security_policy_report_uri
self.content_security_policy_report_only = \
Expand Down Expand Up @@ -307,7 +291,7 @@ def _parse_policy(self, policy):
if isinstance(policy, str):
# parse the string into a policy dict
policy_string = policy
policy = OrderedDict()
policy = {}

for policy_part in policy_string.split(';'):
policy_parts = policy_part.strip().split(' ')
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@

'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',

'Operating System :: POSIX',
'Operating System :: MacOS',
Expand All @@ -60,4 +60,5 @@
packages=['flask_talisman'],

install_requires=[],
python_requires=">=3.7",
)