diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b83218..ff25c4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased](https://github.com/python-social-auth/social-app-webpy/commits/master) ### Changed + - Modified model and access code to work with SQLAlchemy version 2 (Issue #1) - Updated packaging information files per PEP 517, PEP 518 (Issue #2) - Restricted Python minimum working version to 3.7 or higher to align with SQLAlchemy 2 (Issue #1) @@ -16,9 +17,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [1.0.0](https://github.com/python-social-auth/social-app-webpy/releases/tag/1.0.0) - 2017-01-22 ### Added + - Added partial pipeline db storage solution ### Changed + - Remove usage of set/get current strategy methods - Allow apps to have any type of user_id field (port of [#1040](https://github.com/omab/python-social-auth/pull/1040) by prmtl) @@ -26,5 +29,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.0.1](https://github.com/python-social-auth/social-app-webpy/releases/tag/0.0.1) - 2016-11-27 ### Changed + - Split from the monolitic [python-social-auth](https://github.com/omab/python-social-auth) codebase diff --git a/pyproject.toml b/pyproject.toml index 34b391b..7b8ec94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,58 +1,58 @@ [build-system] -requires = ["setuptools"] build-backend = "setuptools.build_meta" +requires = ["setuptools"] + +[options] +zip_safe = false [project] -name = 'social-auth-app-webpy' -dynamic = ["version"] -dependencies = [ - "six", - "social-auth-core>=1.0.0", - "social-auth-storage-sqlalchemy>=1.0.0", -] authors = [ {name = "Matias Aguirre", email = "matiasaguirre@gmail.com"}, - {name = "Lee Ji-ho", email = "search5@gmail.com"}, + {name = "Lee Ji-ho", email = "search5@gmail.com"} +] +classifiers = [ + 'Development Status :: 4 - Beta', + 'Topic :: Internet', + 'License :: OSI Approved :: BSD License', + 'Intended Audience :: Developers', + 'Environment :: Web Environment', + 'Programming Language :: Python', + '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', + 'Programming Language :: Python :: 3.12' +] +dependencies = [ + "six", + "social-auth-core>=1.0.0", + "social-auth-storage-sqlalchemy>=1.0.0" ] description = 'Python Social Authentication, web.py integration.' -license = {text = 'BSD'} +dynamic = ["version"] keywords = ["web.py", "sqlalchemy", "social auth"] +license = {text = 'BSD'} +name = 'social-auth-app-webpy' readme = "README.md" -classifiers=[ - 'Development Status :: 4 - Beta', - 'Topic :: Internet', - 'License :: OSI Approved :: BSD License', - 'Intended Audience :: Developers', - 'Environment :: Web Environment', - 'Programming Language :: Python', - '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', - 'Programming Language :: Python :: 3.12' -] requires-python = ">= 3.7" [project.urls] -Repository = 'https://github.com/python-social-auth/social-app-webpy' +Changelog = 'https://github.com/python-social-auth/social-app-webpy/blob/master/CHANGELOG.md' Documentation = 'http://python-social-auth.readthedocs.org' Issues = 'https://github.com/python-social-auth/social-app-webpy/issues' -Changelog = 'https://github.com/python-social-auth/social-app-webpy/blob/master/CHANGELOG.md' +Repository = 'https://github.com/python-social-auth/social-app-webpy' -[options] -zip_safe = false +[tool.flake8] +# Ignore some well known paths +exclude = ['.venv', '.tox', 'dist', 'doc', 'build', '*.egg', 'db/env.py', 'db/versions/*.py', 'site', 'Pipfile', 'Pipfile.lock'] +max-line-length = 79 [tool.setuptools] include-package-data = true -[tool.setuptools.packages] -find = {} - [tool.setuptools.dynamic] version = {attr = "social_webpy.__version__"} -[tool.flake8] -max-line-length = 79 -# Ignore some well known paths -exclude = ['.venv','.tox','dist','doc','build','*.egg','db/env.py','db/versions/*.py','site','Pipfile','Pipfile.lock'] +[tool.setuptools.packages] +find = {} diff --git a/social_webpy/app.py b/social_webpy/app.py index 58803a7..765e413 100644 --- a/social_webpy/app.py +++ b/social_webpy/app.py @@ -18,7 +18,7 @@ class BaseViewClass: def __init__(self, *args, **kwargs): self.session = web.web_session - method = web.ctx.method == "POST" and "post" or "get" + method = (web.ctx.method == "POST" and "post") or "get" self.strategy = load_strategy() self.data = web.input(_method=method) self.backend = None diff --git a/social_webpy/models.py b/social_webpy/models.py index e2ec3be..2eff511 100644 --- a/social_webpy/models.py +++ b/social_webpy/models.py @@ -49,26 +49,18 @@ def user_model(cls): class Nonce(WebpySocialBase, SQLAlchemyNonceMixin, SocialBase): """One use numbers""" - pass - class Association(WebpySocialBase, SQLAlchemyAssociationMixin, SocialBase): """OpenId account association""" - pass - class Code(WebpySocialBase, SQLAlchemyCodeMixin, SocialBase): """Mail validation single one time use code""" - pass - class Partial(WebpySocialBase, SQLAlchemyPartialMixin, SocialBase): """Partial pipeline storage""" - pass - class WebpyStorage(BaseSQLAlchemyStorage): user = UserSocialAuth diff --git a/social_webpy/utils.py b/social_webpy/utils.py index 69741cf..db8130b 100644 --- a/social_webpy/utils.py +++ b/social_webpy/utils.py @@ -12,8 +12,8 @@ def get_helper(name, do_import=False): - config = web.config.get(setting_name(name), DEFAULTS.get(name, None)) - return do_import and module_member(config) or config + config = web.config.get(setting_name(name), DEFAULTS.get(name)) + return (do_import and module_member(config)) or config def load_strategy(): @@ -43,8 +43,10 @@ def wrapper(self, backend, *args, **kwargs): def backends(user): - """Load Social Auth current user data to context under the key 'backends'. - Will return the output of social_core.backends.utils.user_backends_data.""" + """ + Load Social Auth current user data to context under the key 'backends'. + Will return the output of social_core.backends.utils.user_backends_data. + """ return user_backends_data( user, get_helper("AUTHENTICATION_BACKENDS"), @@ -54,13 +56,13 @@ def backends(user): def login_redirect(): """Load current redirect to context.""" - method = web.ctx.method == "POST" and "post" or "get" + method = (web.ctx.method == "POST" and "post") or "get" data = web.input(_method=method) value = data.get("next") return { "REDIRECT_FIELD_NAME": "next", "REDIRECT_FIELD_VALUE": value, - "REDIRECT_QUERYSTRING": value and ("next=" + value) or "", + "REDIRECT_QUERYSTRING": (value and ("next=" + value)) or "", }