Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imports are Python3 compatible #70

Merged
merged 4 commits into from
Feb 6, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds six into install_requires set and sorts each file's imports with…
… the isort package.
b4oshany authored and davilima6 committed Jan 30, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 0b0a230cb4bbc924ab9758a6f304196314a26c9e
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -14,7 +14,8 @@ New features:

Bug fixes:

- Imports are Python3 compatible
- Imports are Python3 compatible.
Adds six into install_requires set and sorts each file's imports with the isort package.
[b4oshany]


4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from setuptools import setup
from setuptools import find_packages
from setuptools import setup

import sys

version = '1.1.3.dev0'
@@ -53,6 +54,7 @@ def indent(line):
'robotsuite', # not a direct dependency, but required for convenience
'selenium',
'setuptools',
'six',
'zope.component',
'zope.configuration',
'zope.i18n',
12 changes: 7 additions & 5 deletions src/plone/app/robotframework/content.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# -*- coding: utf-8 -*-
from datetime import datetime
import os

from Products.CMFCore.utils import getToolByName
from plone.app.robotframework.config import HAS_BLOBS
from plone.app.robotframework.config import HAS_DEXTERITY
from plone.app.robotframework.config import HAS_DEXTERITY_RELATIONS
from plone.app.robotframework.remote import RemoteLibrary
from plone.app.robotframework.utils import disableCSRFProtection
from plone.i18n.normalizer.interfaces import IURLNormalizer
from plone.uuid.interfaces import IUUID
from Products.CMFCore.utils import getToolByName
from zope.component import ComponentLookupError
from zope.component import getUtility
from zope.component import queryUtility
@@ -18,6 +16,10 @@
from zope.globalrequest import getRequest
from zope.lifecycleevent import ObjectModifiedEvent

import os
import six


if HAS_DEXTERITY:
from plone.app.textfield.value import RichTextValue

@@ -137,10 +139,10 @@ def create_content(self, *args, **kwargs):
if widget and name in kwargs:
if not IFromUnicode.providedBy(field):
value = kwargs[name]
elif isinstance(kwargs[name], unicode):
elif isinstance(kwargs[name], six.text_type):
value = kwargs[name]
else:
value = unicode(str(kwargs[name]), 'utf-8',
value = six.text_type(str(kwargs[name]), 'utf-8',
errors='ignore')
converter = IDataConverter(widget)
dm = queryMultiAdapter((content, field), IDataManager)
9 changes: 7 additions & 2 deletions src/plone/app/robotframework/pybabel.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ def populate(self):
if self._value or self._comments:
self._setter(self._value, self._comments.value)
try:
parts = map(unicode.lower, self._value)
parts = map(six.text_type.lower, self._value)
index = parts.index('translate')
comments = []
for part in filter(lambda x: x.startswith('default='), self._value):
@@ -19,10 +19,15 @@ def populate(self):
except IndexError:
pass

import robot
import robot.parsing.tablepopulators
import six


robot.parsing.tablepopulators.StepPopulator.populate = populate

import robot




def extract_robot(fileobj, keywords, comment_tags, options):
11 changes: 7 additions & 4 deletions src/plone/app/robotframework/saucelabs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# -*- coding: utf-8 -*-
import re
import os
import base64
from robot.libraries.BuiltIn import BuiltIn
from six.moves.http_client import HTTPConnection

import base64
import os
import re


try:
import json
json # pyflakes
except ImportError:
import simplejson as json

from robot.libraries.BuiltIn import BuiltIn

USERNAME_ACCESS_KEY = re.compile('^(http|https):\/\/([^:]+):([^@]+)@')

11 changes: 6 additions & 5 deletions src/plone/app/robotframework/server.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
from plone.app.robotframework.remote import RemoteLibrary
from six.moves.xmlrpc_client import ServerProxy
from six.moves.xmlrpc_server import SimpleXMLRPCServer

import argparse
import logging
import select
import os
import pkg_resources
import select
import sys
import time
from six.moves.xmlrpc_client import ServerProxy
from six.moves.xmlrpc_server import SimpleXMLRPCServer

import pkg_resources

try:
pkg_resources.get_distribution('watchdog')
@@ -19,7 +21,6 @@
from plone.app.robotframework.reload import Watcher
HAS_RELOAD = True

from plone.app.robotframework.remote import RemoteLibrary

HAS_DEBUG_MODE = False
HAS_VERBOSE_CONSOLE = False
13 changes: 9 additions & 4 deletions src/plone/app/robotframework/testing.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
re-usable resources of plone.app.robotframework.
"""
from Acquisition import aq_base
from Products.MailHost.interfaces import IMailHost
from plone.app.robotframework.autologin import AutoLogin
from plone.app.robotframework.content import Content
from plone.app.robotframework.genericsetup import GenericSetup
@@ -15,27 +14,33 @@
from plone.app.robotframework.remote import RemoteLibraryLayer
from plone.app.robotframework.server import Zope2ServerRemote
from plone.app.robotframework.users import Users
from plone.app.testing import applyProfile
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import PloneSandboxLayer
from plone.app.testing import applyProfile
from plone.app.testing import ploneSite
from plone.testing import Layer
from plone.testing import z2
from Products.MailHost.interfaces import IMailHost
from robot.libraries.BuiltIn import BuiltIn
from zope.component import getSiteManager
from zope.configuration import xmlconfig

import os
import pkg_resources
import six
import sys


try:
pkg_resources.get_distribution('collective.js.speakjs')
except pkg_resources.DistributionNotFound:
HAS_SPEAKJS = False
else:
HAS_SPEAKJS = True
from robot.libraries.BuiltIn import BuiltIn




class SimplePublicationLayer(Layer):
@@ -152,7 +157,7 @@ def _get_robot_variable(self, name):
"""
if getattr(BuiltIn(), '_context', None) is not None:
value = BuiltIn().get_variable_value('${%s}' % name, [])
if isinstance(value, str) or isinstance(value, unicode):
if isinstance(value, str) or isinstance(value, six.text_type):
return value.split(',')
else:
return value