Skip to content

Commit

Permalink
Merge 8f8e18e into 1f2bdd1
Browse files Browse the repository at this point in the history
  • Loading branch information
jssuzanne committed May 6, 2021
2 parents 1f2bdd1 + 8f8e18e commit c9ca17a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 8 deletions.
5 changes: 4 additions & 1 deletion anyblok_pyramid/bloks/auth/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
from pyramid.httpexceptions import HTTPUnauthorized
from anyblok import Declarations
from anyblok.column import String
from pyramid.authorization import Allow, ALL_PERMISSIONS
try:
from pyramid.authorization import Allow, ALL_PERMISSIONS
except ImportError:
from pyramid.security import Allow, ALL_PERMISSIONS


@Declarations.register(Declarations.Model)
Expand Down
5 changes: 4 additions & 1 deletion anyblok_pyramid/bloks/authorization/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
from anyblok.relationship import Many2One
from anyblok.field import JsonRelated
from .exceptions import AuthorizationValidationException
from pyramid.authorization import Allow, Deny, ALL_PERMISSIONS
from sqlalchemy import or_
try:
from pyramid.authorization import Allow, Deny, ALL_PERMISSIONS
except ImportError:
from pyramid.security import Allow, Deny, ALL_PERMISSIONS


Pyramid = Declarations.Model.Pyramid
Expand Down
5 changes: 4 additions & 1 deletion anyblok_pyramid/bloks/authorization/tests/test_get_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
# v. 2.0. If a copy of the MPL was not distributed with this file,You can
# obtain one at http://mozilla.org/MPL/2.0/.
import pytest
from pyramid.authorization import Allow, Deny, ALL_PERMISSIONS
try:
from pyramid.authorization import Allow, Deny, ALL_PERMISSIONS
except ImportError:
from pyramid.security import Allow, Deny, ALL_PERMISSIONS


@pytest.mark.usefixtures('rollback_registry')
Expand Down
7 changes: 6 additions & 1 deletion anyblok_pyramid/bloks/pyramid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
# v. 2.0. If a copy of the MPL was not distributed with this file,You can
# obtain one at http://mozilla.org/MPL/2.0/.
from anyblok.blok import Blok
from pyramid.authorization import ACLAuthorizationPolicy
try:
from pyramid.authorization import ACLAuthorizationPolicy
except ImportError:
from pyramid.security import ACLAuthorizationPolicy


from anyblok_pyramid.security import RootFactory
from .pyramid import getAuthenticationPolicy

Expand Down
5 changes: 4 additions & 1 deletion anyblok_pyramid/bloks/pyramid/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
# obtain one at http://mozilla.org/MPL/2.0/.
from pyramid.httpexceptions import HTTPUnauthorized
from anyblok import Declarations
from pyramid.authorization import Allow, ALL_PERMISSIONS
try:
from pyramid.authorization import Allow, ALL_PERMISSIONS
except ImportError:
from pyramid.security import Allow, ALL_PERMISSIONS


@Declarations.register(Declarations.Model)
Expand Down
5 changes: 4 additions & 1 deletion anyblok_pyramid/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
# v. 2.0. If a copy of the MPL was not distributed with this file,You can
# obtain one at http://mozilla.org/MPL/2.0/.
from pyramid.httpexceptions import HTTPUnauthorized
from pyramid.authorization import Deny, Everyone, ALL_PERMISSIONS
try:
from pyramid.authorization import Deny, Everyone, ALL_PERMISSIONS
except ImportError:
from pyramid.security import Deny, Everyone, ALL_PERMISSIONS


def group_finder(userid, request):
Expand Down
5 changes: 4 additions & 1 deletion anyblok_pyramid/test_bloks/test2/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
# v. 2.0. If a copy of the MPL was not distributed with this file,You can
# obtain one at http://mozilla.org/MPL/2.0/.
from anyblok import Declarations
from pyramid.authorization import Allow, Authenticated
from anyblok_pyramid.bloks.pyramid.restrict import restrict_query_by_user
try:
from pyramid.authorization import Allow, Authenticated
except ImportError:
from pyramid.security import Allow, Authenticated


@Declarations.register(Declarations.Model.Pyramid)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

requires = [
'anyblok>=1.1.0',
'pyramid>=2.0.0',
'pyramid<2.0.0',
'pyramid_tm',
'zope.sqlalchemy',
'passlib',
Expand Down

0 comments on commit c9ca17a

Please sign in to comment.