Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Aug 19, 2022
1 parent 40e8072 commit 75f2a8c
Show file tree
Hide file tree
Showing 48 changed files with 1,791 additions and 1,910 deletions.
58 changes: 29 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@
import sys


version = '7.0.0a4.dev0'
version = "7.0.0a4.dev0"


longdescription = open("README.rst").read()
longdescription += '\n'
longdescription += "\n"
longdescription += open("CHANGES.rst").read()

install_requires = [
'DateTime',
'plone.i18n',
'plone.memoize',
'plone.protect>=2.0.3',
'plone.registry',
'plone.session',
'Products.CMFCore',
'Products.GenericSetup',
'Products.PluggableAuthService>=2.0b2.dev0',
'setuptools',
'six',
'zope.component',
'zope.deprecation',
'Zope',
]
"DateTime",
"plone.i18n",
"plone.memoize",
"plone.protect>=2.0.3",
"plone.registry",
"plone.session",
"Products.CMFCore",
"Products.GenericSetup",
"Products.PluggableAuthService>=2.0b2.dev0",
"setuptools",
"six",
"zope.component",
"zope.deprecation",
"Zope",
]

setup(
name='Products.PlonePAS',
name="Products.PlonePAS",
version=version,
description="PlonePAS modifies the PluggableAuthService for use by Plone.",
long_description=longdescription,
Expand All @@ -47,22 +47,22 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
keywords='Zope CMF Plone PAS authentication',
author='Kapil Thangavelu, Wichert Akkerman',
author_email='plone-developers@lists.sourceforge.net',
url='https://github.com/plone/Products.PlonePAS',
license='ZPL',
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['Products'],
keywords="Zope CMF Plone PAS authentication",
author="Kapil Thangavelu, Wichert Akkerman",
author_email="plone-developers@lists.sourceforge.net",
url="https://github.com/plone/Products.PlonePAS",
license="ZPL",
packages=find_packages("src"),
package_dir={"": "src"},
namespace_packages=["Products"],
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
extras_require=dict(
test=[
'plone.app.testing',
'plone.testing',
'plone.app.robotframework',
"plone.app.testing",
"plone.testing",
"plone.app.robotframework",
],
),
)
57 changes: 28 additions & 29 deletions src/Products/PlonePAS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,99 +49,98 @@ def initialize(context):
tools = (GroupsTool, GroupDataTool, MembershipTool, MemberDataTool)

ToolInit(
'PlonePAS Tool',
"PlonePAS Tool",
tools=tools,
icon='tool.gif',
icon="tool.gif",
).initialize(context)

context.registerClass(
role.GroupAwareRoleManager,
permission=add_user_folders,
constructors=(
role.manage_addGroupAwareRoleManagerForm,
role.manage_addGroupAwareRoleManager),
visibility=None
role.manage_addGroupAwareRoleManager,
),
visibility=None,
)

context.registerClass(
user.UserManager,
permission=add_user_folders,
constructors=(
user.manage_addUserManagerForm,
user.manage_addUserManager),
visibility=None
constructors=(user.manage_addUserManagerForm, user.manage_addUserManager),
visibility=None,
)

context.registerClass(
group.GroupManager,
permission=add_user_folders,
constructors=(
group.manage_addGroupManagerForm,
group.manage_addGroupManager
),
visibility=None
constructors=(group.manage_addGroupManagerForm, group.manage_addGroupManager),
visibility=None,
)

context.registerClass(
ufactory.PloneUserFactory,
permission=add_user_folders,
constructors=(
ufactory.manage_addPloneUserFactoryForm,
ufactory.manage_addPloneUserFactory),
visibility=None
ufactory.manage_addPloneUserFactory,
),
visibility=None,
)

context.registerClass(
local_role.LocalRolesManager,
permission=add_user_folders,
constructors=(
local_role.manage_addLocalRolesManagerForm,
local_role.manage_addLocalRolesManager),
visibility=None
local_role.manage_addLocalRolesManager,
),
visibility=None,
)

context.registerClass(
property.ZODBMutablePropertyProvider,
permission=add_user_folders,
constructors=(
property.manage_addZODBMutablePropertyProviderForm,
property.manage_addZODBMutablePropertyProvider),
visibility=None
property.manage_addZODBMutablePropertyProvider,
),
visibility=None,
)

context.registerClass(
crumbler.CookieCrumblingPlugin,
permission=add_user_folders,
constructors=(
crumbler.manage_addCookieCrumblingPluginForm,
crumbler.manage_addCookieCrumblingPlugin),
visibility=None
crumbler.manage_addCookieCrumblingPlugin,
),
visibility=None,
)

context.registerClass(
cookie_handler.ExtendedCookieAuthHelper,
permission=add_user_folders,
constructors=(
cookie_handler.manage_addExtendedCookieAuthHelperForm,
cookie_handler.manage_addExtendedCookieAuthHelper),
visibility=None
cookie_handler.manage_addExtendedCookieAuthHelper,
),
visibility=None,
)

context.registerClass(
autogroup.AutoGroup,
permission=add_user_folders,
constructors=(
autogroup.manage_addAutoGroupForm,
autogroup.manage_addAutoGroup),
visibility=None
constructors=(autogroup.manage_addAutoGroupForm, autogroup.manage_addAutoGroup),
visibility=None,
)

context.registerClass(
passwordpolicy.PasswordPolicyPlugin,
permission=add_user_folders,
constructors=(
passwordpolicy.manage_addPasswordPolicyForm,
passwordpolicy.manage_addPasswordPolicyPlugin
passwordpolicy.manage_addPasswordPolicyPlugin,
),
visibility=None
visibility=None,
)
1 change: 0 additions & 1 deletion src/Products/PlonePAS/browser/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@implementer(IPASInfoView)
class PASInfoView(BrowserView):

def checkExtractorForInterface(self, interface):
acl = getToolByName(aq_inner(self.context), "acl_users")
plugins = acl.plugins.listPlugins(IExtractionPlugin)
Expand Down
22 changes: 11 additions & 11 deletions src/Products/PlonePAS/browser/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@

@implementer(IPASMemberView)
class PASMemberView(BrowserView):

@memoize
def info(self, userid=None):
pm = getToolByName(self.context, 'portal_membership')
pm = getToolByName(self.context, "portal_membership")
result = pm.getMemberInfo(memberId=userid)
if result is None:
# No such member: removed? We return something useful anyway.
return {
'username': userid,
'description': '',
'language': '',
'home_page': '',
'name_or_id': userid,
'location': '',
'fullname': ''
"username": userid,
"description": "",
"language": "",
"home_page": "",
"name_or_id": userid,
"location": "",
"fullname": "",
}
result['name_or_id'] = result.get('fullname') or \
result.get('username') or userid
result["name_or_id"] = (
result.get("fullname") or result.get("username") or userid
)
return result
4 changes: 2 additions & 2 deletions src/Products/PlonePAS/browser/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@

@implementer(IPASSearchView)
class PASSearchView(BrowserView):

@staticmethod
def extractCriteriaFromRequest(request):
criteria = request.form.copy()

for key in ["form.submitted", "submit", 'b_start', 'b_size']:
for key in ["form.submitted", "submit", "b_start", "b_size"]:
if key in criteria:
del criteria[key]

Expand Down Expand Up @@ -43,6 +42,7 @@ def sort(self, results, sort_key):

def key_func(a):
return idnormalizer.normalize(a.get(sort_key, a))

return sorted(results, key=key_func)

def searchUsers(self, sort_by=None, **criteria):
Expand Down
19 changes: 10 additions & 9 deletions src/Products/PlonePAS/config.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# -*- coding: utf-8 -*-
PROJECTNAME = 'PlonePAS'
PROJECTNAME = "PlonePAS"
GLOBALS = globals()

DEFAULT_CHALLENGE_PROTOCOL = ['http']
DEFAULT_CHALLENGE_PROTOCOL = ["http"]
DEFAULT_PROTO_MAPPING = {
'WebDAV': DEFAULT_CHALLENGE_PROTOCOL,
'FTP': DEFAULT_CHALLENGE_PROTOCOL,
'XML-RPC': DEFAULT_CHALLENGE_PROTOCOL
"WebDAV": DEFAULT_CHALLENGE_PROTOCOL,
"FTP": DEFAULT_CHALLENGE_PROTOCOL,
"XML-RPC": DEFAULT_CHALLENGE_PROTOCOL,
}

# Settings for member image resize quality
HAS_PIL = True
try:
from PIL import Image

PIL_SCALING_ALGO = Image.ANTIALIAS
except ImportError:
PIL_SCALING_ALGO = None
Expand All @@ -21,8 +22,8 @@
PIL_QUALITY = 88
MEMBER_IMAGE_SCALE = (75, 100)
IMAGE_SCALE_PARAMS = {
'scale': MEMBER_IMAGE_SCALE,
'quality': PIL_QUALITY,
'algorithm': PIL_SCALING_ALGO,
'default_format': 'PNG'
"scale": MEMBER_IMAGE_SCALE,
"quality": PIL_QUALITY,
"algorithm": PIL_SCALING_ALGO,
"default_format": "PNG",
}
6 changes: 1 addition & 5 deletions src/Products/PlonePAS/interfaces/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class IPASInfoView(Interface):

def hasLoginPasswordExtractor():
"""Check if a login & password extraction plugin is active.
Expand All @@ -13,8 +12,7 @@ def hasLoginPasswordExtractor():
"""

def hasOpenIDExtractor():
"""Check if an OpenID extraction plugin is active.
"""
"""Check if an OpenID extraction plugin is active."""

def hasOpenIDdExtractor():
"""Check if an OpenID extraction plugin is active.
Expand All @@ -24,15 +22,13 @@ def hasOpenIDdExtractor():


class IPASMemberView(Interface):

def info(userid=None):
"""Return 'harmless' member info of any user, such as full name,
location, etc.
"""


class IPASSearchView(Interface):

def searchUsers(sort_by=None, any_field=None, **criteria):
"""Search for users matching a set of criteria.
Expand Down
3 changes: 1 addition & 2 deletions src/Products/PlonePAS/interfaces/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@


class IUserInitialLoginInEvent(IUserLoggedInEvent):
"""A user logs in for the first time in the portal.
"""
"""A user logs in for the first time in the portal."""
Loading

0 comments on commit 75f2a8c

Please sign in to comment.