-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fc] Repository: plone.recipe.zope2instance
Branch: refs/heads/master Date: 2017-10-22T17:10:08+02:00 Author: ale-rt (ale-rt) <alessandro.pisa@gmail.com> Commit: plone/plone.recipe.zope2instance@90309bd Python 3 compatibility with sixer Files changed: M CHANGES.rst M setup.py M src/plone/recipe/zope2instance/ctl.py M src/plone/recipe/zope2instance/make.py Repository: plone.recipe.zope2instance Branch: refs/heads/master Date: 2017-10-23T17:25:47+02:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.recipe.zope2instance@8d2189b Merge pull request #34 from plone/py3_compat Python 3 compatibility with sixer Files changed: M CHANGES.rst M setup.py M src/plone/recipe/zope2instance/ctl.py M src/plone/recipe/zope2instance/make.py
- Loading branch information
1 parent
6d0b02c
commit 2b0c5d5
Showing
1 changed file
with
288 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,304 @@ | ||
Repository: five.intid | ||
Repository: plone.recipe.zope2instance | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2017-10-23T15:21:16+02:00 | ||
Author: Philip Bauer (pbauer) <bauer@starzel.de> | ||
Commit: https://github.com/plone/five.intid/commit/e12798defb749a3eab47175e03e6baf65753e1f0 | ||
Date: 2017-10-22T17:10:08+02:00 | ||
Author: ale-rt (ale-rt) <alessandro.pisa@gmail.com> | ||
Commit: https://github.com/plone/plone.recipe.zope2instance/commit/90309bd363e09db27142fe38ae50bbce862f064b | ||
|
||
Adapt raised errors to changes in zope.intid | ||
Python 3 compatibility with sixer | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M five/intid/README.rst | ||
M setup.py | ||
M src/plone/recipe/zope2instance/ctl.py | ||
M src/plone/recipe/zope2instance/make.py | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index 3a062a1..5d7aa2f 100644 | ||
index 893c770..f190bfd 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -14,7 +14,8 @@ New features: | ||
@@ -15,6 +15,8 @@ New features: | ||
|
||
Bug fixes: | ||
|
||
-- *add item here* | ||
+- Adapt raised errors to changes in zope.intid | ||
+ [pbauer] | ||
|
||
|
||
1.1.2 (2016-09-09) | ||
diff --git a/five/intid/README.rst b/five/intid/README.rst | ||
index ee620e3..f5914b7 100644 | ||
--- a/five/intid/README.rst | ||
+++ b/five/intid/README.rst | ||
@@ -74,7 +74,7 @@ utility:: | ||
>>> intid.getId(content1) | ||
Traceback (most recent call last): | ||
... | ||
- KeyError: <SimpleContent at /test_folder_1_/mycont1> | ||
+ IntIdMissingError: <SimpleContent at /test_folder_1_/mycont1> | ||
|
||
We can call the keyreferences, and get the objects back:: | ||
|
||
@@ -137,7 +137,7 @@ Registering and unregistering objects does not fire these events:: | ||
>>> intid.getObject(uid) | ||
Traceback (most recent call last): | ||
... | ||
- KeyError: ... | ||
+ ObjectMissingError: ... | ||
|
||
>>> tests.NOTIFIED[0] | ||
'No change' | ||
+- Python 3 compatibility with sixer | ||
+ [ale-rt] | ||
- Fix import. zopectl moved to ZServer | ||
[pbauer] | ||
|
||
diff --git a/setup.py b/setup.py | ||
index a87e127..ccaf4cf 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -40,6 +40,7 @@ | ||
install_requires=[ | ||
'zc.buildout', | ||
'setuptools', | ||
+ 'six', | ||
'zc.recipe.egg', | ||
'Zope2 >= 2.12.1', | ||
'ZODB >= 5.1.1', | ||
diff --git a/src/plone/recipe/zope2instance/ctl.py b/src/plone/recipe/zope2instance/ctl.py | ||
index 1909bbf..de0af72 100644 | ||
--- a/src/plone/recipe/zope2instance/ctl.py | ||
+++ b/src/plone/recipe/zope2instance/ctl.py | ||
@@ -101,7 +101,7 @@ def _get_service_status(self): | ||
name = self._get_service_name() | ||
try: | ||
status = win32serviceutil.QueryServiceStatus(name)[1] | ||
- except pywintypes.error, err: | ||
+ except pywintypes.error as err: | ||
# (1060, 'GetServiceKeyName', 'The specified service does not | ||
# exist as an installed service.') | ||
if err[0] == 1060: | ||
@@ -162,7 +162,7 @@ def do_install(self, arg): | ||
|
||
class_string = self._get_service_class_string() | ||
name = self._get_service_name() | ||
- display_name = 'Zope instance at '+ self.options.directory | ||
+ display_name = 'Zope instance at ' + self.options.directory | ||
|
||
if arg.lower() == 'auto': | ||
start_type = win32service.SERVICE_AUTO_START | ||
@@ -204,10 +204,14 @@ def do_install(self, arg): | ||
return ret_code | ||
|
||
def help_install(self): | ||
- print 'install -- Install Zope as a Windows service that must be '\ | ||
- 'manually started.' | ||
- print 'install auto -- Install Zope as a Windows service that '\ | ||
- 'starts at system startup.' | ||
+ print( | ||
+ 'install -- Install Zope as a Windows service that must be ' | ||
+ 'manually started.' | ||
+ ) | ||
+ print( | ||
+ 'install auto -- Install Zope as a Windows service that ' | ||
+ 'starts at system startup.' | ||
+ ) | ||
|
||
def do_start(self, arg): | ||
|
||
@@ -283,8 +287,10 @@ def do_remove(self, arg): | ||
print('ERROR: Zope is not installed as a Windows service.') | ||
return | ||
elif status is not win32service.SERVICE_STOPPED: | ||
- print 'ERROR: Please stop the Windows service before '\ | ||
- 'removing it.' | ||
+ print ( | ||
+ 'ERROR: Please stop the Windows service before ' | ||
+ 'removing it.' | ||
+ ) | ||
return | ||
|
||
ret_code = 0 | ||
@@ -339,9 +345,11 @@ def do_status(self, arg=''): | ||
# TODO: what about "self.zd_up"? | ||
|
||
def help_status(self): | ||
- print 'status -- Print status of the Windows service.' | ||
- print 'status -l -- Print status of the Windows service, '\ | ||
- 'and raw status output.' | ||
+ print('status -- Print status of the Windows service.') | ||
+ print( | ||
+ 'status -l -- Print status of the Windows service, ' | ||
+ 'and raw status output.' | ||
+ ) | ||
|
||
def help_EOF(self): | ||
print('To quit, type CTRL+Z or use the quit command.') | ||
@@ -386,7 +394,7 @@ def do_start(self, arg): | ||
self.send_action("start") | ||
else: | ||
print('daemon process already running; pid={}'.format( | ||
- self.zd_pid)) | ||
+ self.zd_pid)) | ||
return | ||
|
||
def cond(n=0): | ||
@@ -495,7 +503,7 @@ def do_run(self, arg): | ||
# If that's the case, we'll use csv to do the parsing | ||
# so that we can split on spaces while respecting quotes. | ||
if len(self.options.args) == 1: | ||
- tup = csv.reader(self.options.args, delimiter=' ').next()[1:] | ||
+ tup = next(csv.reader(self.options.args, delimiter=' '))[1:] | ||
else: | ||
tup = self.options.args[1:] | ||
|
||
diff --git a/src/plone/recipe/zope2instance/make.py b/src/plone/recipe/zope2instance/make.py | ||
index c080b61..b5630c1 100644 | ||
--- a/src/plone/recipe/zope2instance/make.py | ||
+++ b/src/plone/recipe/zope2instance/make.py | ||
@@ -2,6 +2,7 @@ | ||
from __future__ import print_function | ||
from binascii import b2a_base64 | ||
from hashlib import sha1 | ||
+from six.moves import input | ||
|
||
import os | ||
import os.path | ||
@@ -39,7 +40,7 @@ def get_inituser(): | ||
These will be the credentials you use to initially manage | ||
your new Zope instance. | ||
""") | ||
- user = raw_input('Username: ').strip() | ||
+ user = input('Username: ').strip() | ||
if user == '': | ||
return None, None | ||
while 1: | ||
|
||
|
||
Repository: plone.recipe.zope2instance | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2017-10-23T17:25:47+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/plone.recipe.zope2instance/commit/8d2189bec74c708d9a820bd168f0cbd8de2b2142 | ||
|
||
Merge pull request #34 from plone/py3_compat | ||
|
||
Python 3 compatibility with sixer | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M setup.py | ||
M src/plone/recipe/zope2instance/ctl.py | ||
M src/plone/recipe/zope2instance/make.py | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index 893c770..f190bfd 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -15,6 +15,8 @@ New features: | ||
|
||
Bug fixes: | ||
|
||
+- Python 3 compatibility with sixer | ||
+ [ale-rt] | ||
- Fix import. zopectl moved to ZServer | ||
[pbauer] | ||
|
||
diff --git a/setup.py b/setup.py | ||
index a87e127..ccaf4cf 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -40,6 +40,7 @@ | ||
install_requires=[ | ||
'zc.buildout', | ||
'setuptools', | ||
+ 'six', | ||
'zc.recipe.egg', | ||
'Zope2 >= 2.12.1', | ||
'ZODB >= 5.1.1', | ||
diff --git a/src/plone/recipe/zope2instance/ctl.py b/src/plone/recipe/zope2instance/ctl.py | ||
index 1909bbf..de0af72 100644 | ||
--- a/src/plone/recipe/zope2instance/ctl.py | ||
+++ b/src/plone/recipe/zope2instance/ctl.py | ||
@@ -101,7 +101,7 @@ def _get_service_status(self): | ||
name = self._get_service_name() | ||
try: | ||
status = win32serviceutil.QueryServiceStatus(name)[1] | ||
- except pywintypes.error, err: | ||
+ except pywintypes.error as err: | ||
# (1060, 'GetServiceKeyName', 'The specified service does not | ||
# exist as an installed service.') | ||
if err[0] == 1060: | ||
@@ -162,7 +162,7 @@ def do_install(self, arg): | ||
|
||
class_string = self._get_service_class_string() | ||
name = self._get_service_name() | ||
- display_name = 'Zope instance at '+ self.options.directory | ||
+ display_name = 'Zope instance at ' + self.options.directory | ||
|
||
if arg.lower() == 'auto': | ||
start_type = win32service.SERVICE_AUTO_START | ||
@@ -204,10 +204,14 @@ def do_install(self, arg): | ||
return ret_code | ||
|
||
def help_install(self): | ||
- print 'install -- Install Zope as a Windows service that must be '\ | ||
- 'manually started.' | ||
- print 'install auto -- Install Zope as a Windows service that '\ | ||
- 'starts at system startup.' | ||
+ print( | ||
+ 'install -- Install Zope as a Windows service that must be ' | ||
+ 'manually started.' | ||
+ ) | ||
+ print( | ||
+ 'install auto -- Install Zope as a Windows service that ' | ||
+ 'starts at system startup.' | ||
+ ) | ||
|
||
def do_start(self, arg): | ||
|
||
@@ -283,8 +287,10 @@ def do_remove(self, arg): | ||
print('ERROR: Zope is not installed as a Windows service.') | ||
return | ||
elif status is not win32service.SERVICE_STOPPED: | ||
- print 'ERROR: Please stop the Windows service before '\ | ||
- 'removing it.' | ||
+ print ( | ||
+ 'ERROR: Please stop the Windows service before ' | ||
+ 'removing it.' | ||
+ ) | ||
return | ||
|
||
ret_code = 0 | ||
@@ -339,9 +345,11 @@ def do_status(self, arg=''): | ||
# TODO: what about "self.zd_up"? | ||
|
||
def help_status(self): | ||
- print 'status -- Print status of the Windows service.' | ||
- print 'status -l -- Print status of the Windows service, '\ | ||
- 'and raw status output.' | ||
+ print('status -- Print status of the Windows service.') | ||
+ print( | ||
+ 'status -l -- Print status of the Windows service, ' | ||
+ 'and raw status output.' | ||
+ ) | ||
|
||
def help_EOF(self): | ||
print('To quit, type CTRL+Z or use the quit command.') | ||
@@ -386,7 +394,7 @@ def do_start(self, arg): | ||
self.send_action("start") | ||
else: | ||
print('daemon process already running; pid={}'.format( | ||
- self.zd_pid)) | ||
+ self.zd_pid)) | ||
return | ||
|
||
def cond(n=0): | ||
@@ -495,7 +503,7 @@ def do_run(self, arg): | ||
# If that's the case, we'll use csv to do the parsing | ||
# so that we can split on spaces while respecting quotes. | ||
if len(self.options.args) == 1: | ||
- tup = csv.reader(self.options.args, delimiter=' ').next()[1:] | ||
+ tup = next(csv.reader(self.options.args, delimiter=' '))[1:] | ||
else: | ||
tup = self.options.args[1:] | ||
|
||
diff --git a/src/plone/recipe/zope2instance/make.py b/src/plone/recipe/zope2instance/make.py | ||
index c080b61..b5630c1 100644 | ||
--- a/src/plone/recipe/zope2instance/make.py | ||
+++ b/src/plone/recipe/zope2instance/make.py | ||
@@ -2,6 +2,7 @@ | ||
from __future__ import print_function | ||
from binascii import b2a_base64 | ||
from hashlib import sha1 | ||
+from six.moves import input | ||
|
||
import os | ||
import os.path | ||
@@ -39,7 +40,7 @@ def get_inituser(): | ||
These will be the credentials you use to initially manage | ||
your new Zope instance. | ||
""") | ||
- user = raw_input('Username: ').strip() | ||
+ user = input('Username: ').strip() | ||
if user == '': | ||
return None, None | ||
while 1: | ||
|
||
|