Skip to content

Commit

Permalink
[fc] Repository: plone.app.users
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2018-03-21T21:52:09+01:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: plone/plone.app.users@5075368

py3 fixes

Files changed:
M plone/app/users/browser/register.py
M plone/app/users/browser/schemaeditor.py
M plone/app/users/vocabularies.py
Repository: plone.app.users

Branch: refs/heads/master
Date: 2018-03-29T12:03:42+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: plone/plone.app.users@5a1ca66

fix userschema import in py3

Files changed:
M plone/app/users/setuphandlers.py
Repository: plone.app.users

Branch: refs/heads/master
Date: 2018-04-02T20:40:04+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: plone/plone.app.users@68f04ce

allow text for user_id in py3

Files changed:
M plone/app/users/browser/register.py
Repository: plone.app.users

Branch: refs/heads/master
Date: 2018-04-04T16:24:27+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.users@6b84ca0

Update CHANGES.rst

Files changed:
M CHANGES.rst
Repository: plone.app.users

Branch: refs/heads/master
Date: 2018-04-04T18:16:04+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.users@914951f

Merge pull request #70 from plone/python3

Python 3

Files changed:
M CHANGES.rst
M plone/app/users/browser/register.py
M plone/app/users/browser/schemaeditor.py
M plone/app/users/setuphandlers.py
M plone/app/users/vocabularies.py
  • Loading branch information
jensens committed Apr 4, 2018
1 parent eaeeaf1 commit dd6479a
Showing 1 changed file with 281 additions and 47 deletions.
328 changes: 281 additions & 47 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,102 +1,336 @@
Repository: plone.app.registry
Repository: plone.app.users


Branch: refs/heads/master
Date: 2018-03-15T16:34:54+01:00
Date: 2018-03-21T21:52:09+01:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.registry/commit/f2e45fe24fef89953779b611afdcde098210e29d
Commit: https://github.com/plone/plone.app.users/commit/5075368436c871e0464448e34dbdfaba651067ef

fix py3 issue
py3 fixes

Files changed:
M plone/app/registry/browser/records.py
M plone/app/users/browser/register.py
M plone/app/users/browser/schemaeditor.py
M plone/app/users/vocabularies.py

diff --git a/plone/app/registry/browser/records.py b/plone/app/registry/browser/records.py
index 247d212..93454f1 100644
--- a/plone/app/registry/browser/records.py
+++ b/plone/app/registry/browser/records.py
@@ -54,7 +54,7 @@ def shouldPurge(self):
return False
diff --git a/plone/app/users/browser/register.py b/plone/app/users/browser/register.py
index 993a98e..f1b5f94 100644
--- a/plone/app/users/browser/register.py
+++ b/plone/app/users/browser/register.py
@@ -443,7 +443,7 @@ def handle_join_success(self, data):

try:
registration.addMember(user_id, password, REQUEST=self.request)
- except (AttributeError, ValueError), err:
+ except (AttributeError, ValueError) as err:
logging.exception(err)
IStatusMessage(self.request).addStatusMessage(err, type="error")
return
@@ -703,7 +703,7 @@ def action_join(self, action):
raise Forbidden
portal_groups.addPrincipalToGroup(user_id, groupname,
self.request)
- except (AttributeError, ValueError), err:
+ except (AttributeError, ValueError) as err:
IStatusMessage(self.request).addStatusMessage(err, type="error")
return

-_valid_field_name_chars = string.letters + '._'
+_valid_field_name_chars = string.ascii_letters + '._'
diff --git a/plone/app/users/browser/schemaeditor.py b/plone/app/users/browser/schemaeditor.py
index ddcedf6..5c7e304 100644
--- a/plone/app/users/browser/schemaeditor.py
+++ b/plone/app/users/browser/schemaeditor.py
@@ -337,7 +337,7 @@ def copySchemaAttrs(schema, form_name):
])


def checkFieldName(val):
-default_fields = IUserDataSchema.names() + IRegisterSchema.names()
+default_fields = list(IUserDataSchema.names()) + list(IRegisterSchema.names())


def field_in_form(field, form_name=None):
diff --git a/plone/app/users/vocabularies.py b/plone/app/users/vocabularies.py
index aa617cc..3d2cefb 100644
--- a/plone/app/users/vocabularies.py
+++ b/plone/app/users/vocabularies.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from AccessControl import getSecurityManager
-from browser.schemaeditor import getFromBaseSchema
+from .browser.schemaeditor import getFromBaseSchema
from plone.app.users.schema import ICombinedRegisterSchema
from Products.CMFCore.permissions import ManagePortal
from Products.CMFCore.utils import getToolByName


Repository: plone.app.users


Branch: refs/heads/master
Date: 2018-03-29T12:03:42+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.users/commit/5a1ca66b43ed1346ee9e89e625cc2775d986a25e

fix userschema import in py3

Files changed:
M plone/app/users/setuphandlers.py

diff --git a/plone/app/users/setuphandlers.py b/plone/app/users/setuphandlers.py
index 4b93a2b..94e9b0a 100644
--- a/plone/app/users/setuphandlers.py
+++ b/plone/app/users/setuphandlers.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import logging
import plone.app.users.browser.schemaeditor as ttw
-
+import six

logger = logging.getLogger('plone.app.users.setuphandlers')

@@ -14,6 +14,8 @@ def import_schema(context):
data = context.readDataFile(FILE)
if data is None:
return
+ if six.PY3 and isinstance(data, bytes):
+ data = data.decode('utf-8')
ttw.applySchema(data)
logger.info('Imported schema')


Repository: plone.app.registry

Repository: plone.app.users


Branch: refs/heads/master
Date: 2018-04-04T16:56:56+02:00
Date: 2018-04-02T20:40:04+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.users/commit/68f04ceca8315223ec74567c42abcff28f01886b

allow text for user_id in py3

Files changed:
M plone/app/users/browser/register.py

diff --git a/plone/app/users/browser/register.py b/plone/app/users/browser/register.py
index f1b5f94..6b5ecd0 100644
--- a/plone/app/users/browser/register.py
+++ b/plone/app/users/browser/register.py
@@ -37,6 +37,7 @@
from zope.schema import getFieldNames

import logging
+import six


# Number of retries for creating a user id like bob-jones-42:
@@ -418,13 +419,14 @@ def handle_join_success(self, data):
# user_id and login_name should be in the data, but let's be safe.
user_id = data.get('user_id', data.get('username'))
login_name = data.get('login_name', data.get('username'))
- # I have seen a unicode user id. I cannot reproduce it, but
- # let's make them strings, otherwise you run into trouble with
- # plone.session when trying to login.
- if isinstance(user_id, unicode):
- user_id = user_id.encode('utf8')
- if isinstance(login_name, unicode):
- login_name = login_name.encode('utf8')
+ if six.PY2:
+ # I have seen a unicode user id. I cannot reproduce it, but
+ # let's make them strings, otherwise you run into trouble with
+ # plone.session when trying to login.
+ if isinstance(user_id, six.text_type):
+ user_id = user_id.encode('utf8')
+ if isinstance(login_name, six.text_type):
+ login_name = login_name.encode('utf8')

# Set the username for good measure, as some code may expect
# it to exist and contain the user id.
@@ -438,7 +440,7 @@ def handle_join_success(self, data):
self.request.form['form.username'] = login_name

password = data.get('password') or registration.generatePassword()
- if isinstance(password, unicode):
+ if six.PY2 and isinstance(password, six.text_type):
password = password.encode('utf8')

try:


Repository: plone.app.users


Branch: refs/heads/master
Date: 2018-04-04T16:24:27+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/plone.app.registry/commit/bcef47c3833baadde5f5fef9b830c7175e0731e2
Commit: https://github.com/plone/plone.app.users/commit/6b84ca0d18580f3afaeac06d89ea463d37936da3

Update CHANGES.rst

Files changed:
M CHANGES.rst

diff --git a/CHANGES.rst b/CHANGES.rst
index 0f62e27..06b6793 100644
index d6ca4e1..2b266f6 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,7 +14,8 @@ New features:

Bug fixes:

-- *add item here*
+- Python 2 / 3 compatible imports.
@@ -20,7 +20,12 @@ Bug fixes:
- Provide the UserDataPanelAdapter for INavigationRoot, so @@personal-information
is not broken with p.a.multilingual
[ebrehault]
-- Fix tests to avoid using testbrowser internals. [davisagli]
+
+- Fix tests to avoid using testbrowser internals.
+ [davisagli]
+
+- Python 3 fixes.
+ [pbauer]


1.7 (2018-02-04)
2.4 (2017-06-20)


Repository: plone.app.registry
Repository: plone.app.users


Branch: refs/heads/master
Date: 2018-04-04T18:15:41+02:00
Date: 2018-04-04T18:16:04+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/plone.app.registry/commit/61d1998293909dca8cdb9dd294da981775c7b90a
Commit: https://github.com/plone/plone.app.users/commit/914951f4c99d67e44b4a44f9c79d0cd220852a52

Merge pull request #30 from plone/python3
Merge pull request #70 from plone/python3

fix py3 issue
Python 3

Files changed:
M CHANGES.rst
M plone/app/registry/browser/records.py
M plone/app/users/browser/register.py
M plone/app/users/browser/schemaeditor.py
M plone/app/users/setuphandlers.py
M plone/app/users/vocabularies.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 0f62e27..06b6793 100644
index d6ca4e1..2b266f6 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,7 +14,8 @@ New features:
@@ -20,7 +20,12 @@ Bug fixes:
- Provide the UserDataPanelAdapter for INavigationRoot, so @@personal-information
is not broken with p.a.multilingual
[ebrehault]
-- Fix tests to avoid using testbrowser internals. [davisagli]
+
+- Fix tests to avoid using testbrowser internals.
+ [davisagli]
+
+- Python 3 fixes.
+ [pbauer]

Bug fixes:

-- *add item here*
+- Python 2 / 3 compatible imports.
+ [pbauer]
2.4 (2017-06-20)
diff --git a/plone/app/users/browser/register.py b/plone/app/users/browser/register.py
index 993a98e..6b5ecd0 100644
--- a/plone/app/users/browser/register.py
+++ b/plone/app/users/browser/register.py
@@ -37,6 +37,7 @@
from zope.schema import getFieldNames

import logging
+import six


# Number of retries for creating a user id like bob-jones-42:
@@ -418,13 +419,14 @@ def handle_join_success(self, data):
# user_id and login_name should be in the data, but let's be safe.
user_id = data.get('user_id', data.get('username'))
login_name = data.get('login_name', data.get('username'))
- # I have seen a unicode user id. I cannot reproduce it, but
- # let's make them strings, otherwise you run into trouble with
- # plone.session when trying to login.
- if isinstance(user_id, unicode):
- user_id = user_id.encode('utf8')
- if isinstance(login_name, unicode):
- login_name = login_name.encode('utf8')
+ if six.PY2:
+ # I have seen a unicode user id. I cannot reproduce it, but
+ # let's make them strings, otherwise you run into trouble with
+ # plone.session when trying to login.
+ if isinstance(user_id, six.text_type):
+ user_id = user_id.encode('utf8')
+ if isinstance(login_name, six.text_type):
+ login_name = login_name.encode('utf8')

# Set the username for good measure, as some code may expect
# it to exist and contain the user id.
@@ -438,12 +440,12 @@ def handle_join_success(self, data):
self.request.form['form.username'] = login_name

password = data.get('password') or registration.generatePassword()
- if isinstance(password, unicode):
+ if six.PY2 and isinstance(password, six.text_type):
password = password.encode('utf8')

try:
registration.addMember(user_id, password, REQUEST=self.request)
- except (AttributeError, ValueError), err:
+ except (AttributeError, ValueError) as err:
logging.exception(err)
IStatusMessage(self.request).addStatusMessage(err, type="error")
return
@@ -703,7 +705,7 @@ def action_join(self, action):
raise Forbidden
portal_groups.addPrincipalToGroup(user_id, groupname,
self.request)
- except (AttributeError, ValueError), err:
+ except (AttributeError, ValueError) as err:
IStatusMessage(self.request).addStatusMessage(err, type="error")
return

diff --git a/plone/app/users/browser/schemaeditor.py b/plone/app/users/browser/schemaeditor.py
index ddcedf6..5c7e304 100644
--- a/plone/app/users/browser/schemaeditor.py
+++ b/plone/app/users/browser/schemaeditor.py
@@ -337,7 +337,7 @@ def copySchemaAttrs(schema, form_name):
])


-default_fields = IUserDataSchema.names() + IRegisterSchema.names()
+default_fields = list(IUserDataSchema.names()) + list(IRegisterSchema.names())

1.7 (2018-02-04)
diff --git a/plone/app/registry/browser/records.py b/plone/app/registry/browser/records.py
index 247d212..93454f1 100644
--- a/plone/app/registry/browser/records.py
+++ b/plone/app/registry/browser/records.py
@@ -54,7 +54,7 @@ def shouldPurge(self):
return False

def field_in_form(field, form_name=None):
diff --git a/plone/app/users/setuphandlers.py b/plone/app/users/setuphandlers.py
index 4b93a2b..94e9b0a 100644
--- a/plone/app/users/setuphandlers.py
+++ b/plone/app/users/setuphandlers.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import logging
import plone.app.users.browser.schemaeditor as ttw
-
+import six

-_valid_field_name_chars = string.letters + '._'
+_valid_field_name_chars = string.ascii_letters + '._'
logger = logging.getLogger('plone.app.users.setuphandlers')

@@ -14,6 +14,8 @@ def import_schema(context):
data = context.readDataFile(FILE)
if data is None:
return
+ if six.PY3 and isinstance(data, bytes):
+ data = data.decode('utf-8')
ttw.applySchema(data)
logger.info('Imported schema')

def checkFieldName(val):
diff --git a/plone/app/users/vocabularies.py b/plone/app/users/vocabularies.py
index aa617cc..3d2cefb 100644
--- a/plone/app/users/vocabularies.py
+++ b/plone/app/users/vocabularies.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from AccessControl import getSecurityManager
-from browser.schemaeditor import getFromBaseSchema
+from .browser.schemaeditor import getFromBaseSchema
from plone.app.users.schema import ICombinedRegisterSchema
from Products.CMFCore.permissions import ManagePortal
from Products.CMFCore.utils import getToolByName


0 comments on commit dd6479a

Please sign in to comment.