Commit 5e8844ea authored by Jérome Perrin's avatar Jérome Perrin

configurator: py3

parent 6859c8ef
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
############################################################################## ##############################################################################
import zope.interface import zope.interface
from six.moves import cStringIO as StringIO import io
from Acquisition import aq_base from Acquisition import aq_base
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
...@@ -37,10 +37,6 @@ from erp5.component.interface.IConfiguratorItem import IConfiguratorItem ...@@ -37,10 +37,6 @@ from erp5.component.interface.IConfiguratorItem import IConfiguratorItem
import six import six
class UnrestrictedStringIO(StringIO):
__allow_access_to_unprotected_subobjects__ = 1
@zope.interface.implementer(IConfiguratorItem) @zope.interface.implementer(IConfiguratorItem)
class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject): class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
"""Import a categories spreadsheet. """Import a categories spreadsheet.
...@@ -95,9 +91,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -95,9 +91,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
path = path[cat] path = path[cat]
edit_dict = category_info.copy() edit_dict = category_info.copy()
edit_dict.pop('path') edit_dict.pop('path')
if 'id' in edit_dict.keys(): edit_dict.pop('id', None)
edit_dict.pop('id')
path.edit(**edit_dict) path.edit(**edit_dict)
## add to customer template ## add to customer template
business_configuration = self.getBusinessConfigurationValue() business_configuration = self.getBusinessConfigurationValue()
...@@ -117,7 +111,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -117,7 +111,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
# TODO use a invalid_spreadsheet_error_handler to report invalid # TODO use a invalid_spreadsheet_error_handler to report invalid
# spreadsheet messages (see http://svn.erp5.org?rev=24908&view=rev ) # spreadsheet messages (see http://svn.erp5.org?rev=24908&view=rev )
aq_self._category_cache = self.Base_getCategoriesSpreadSheetMapping( aq_self._category_cache = self.Base_getCategoriesSpreadSheetMapping(
UnrestrictedStringIO(self.getDefaultConfigurationSpreadsheetData())) io.BytesIO(self.getDefaultConfigurationSpreadsheetData()))
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'setDefaultConfigurationSpreadsheetFile') 'setDefaultConfigurationSpreadsheetFile')
......
...@@ -93,7 +93,7 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec ...@@ -93,7 +93,7 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec
business_configuration = self.getBusinessConfigurationValue() business_configuration = self.getBusinessConfigurationValue()
bt5_obj = business_configuration.getSpecialiseValue() bt5_obj = business_configuration.getSpecialiseValue()
if bt5_obj is not None: if bt5_obj is not None:
bt5_obj.edit(template_portal_type_role_list=portal_type_role_dict.keys()) bt5_obj.edit(template_portal_type_role_list=list(portal_type_role_dict.keys()))
return error_list return error_list
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
# This extension should be replaced by a clever parser provided by # This extension should be replaced by a clever parser provided by
# ERP5OOo or probably by CloudOOo itself. # ERP5OOo or probably by CloudOOo itself.
import six
from io import BytesIO from io import BytesIO
def read(self, filename, data): def read(self, filename, data):
...@@ -38,7 +40,7 @@ def read(self, filename, data): ...@@ -38,7 +40,7 @@ def read(self, filename, data):
""" """
if data is None: if data is None:
oo_template_file = getattr(self, filename) oo_template_file = getattr(self, filename)
fp = BytesIO(oo_template_file) fp = BytesIO(bytes(oo_template_file))
else: else:
fp = BytesIO(data) fp = BytesIO(data)
fp.filename = filename fp.filename = filename
...@@ -61,7 +63,9 @@ def getIdFromString(string): ...@@ -61,7 +63,9 @@ def getIdFromString(string):
# Following line is a workaround for this, # Following line is a workaround for this,
# because \u2013 does not exist in latin1 # because \u2013 does not exist in latin1
string = string.replace(u'\u2013', '-') string = string.replace(u'\u2013', '-')
for char in string.encode('utf-8'):#('iso8859_1'): if six.PY2:
string = string.encode('utf-8')
for char in string:
if char == '_' or char.isalnum(): if char == '_' or char.isalnum():
clean_id += char clean_id += char
elif char.isspace() or char in ('+', '-'): elif char.isspace() or char in ('+', '-'):
...@@ -119,12 +123,16 @@ def convert(self, filename, data=None): ...@@ -119,12 +123,16 @@ def convert(self, filename, data=None):
# Get the property corresponding to the cell data # Get the property corresponding to the cell data
property_id = property_map[cell_index] property_id = property_map[cell_index]
# Convert the value to something like '\xc3\xa9' not '\xc3\xa9' # Convert the value to something like '\xc3\xa9' not '\xc3\xa9'
object_property_dict[property_id] = cell.encode('UTF-8') if six.PY2:
cell = cell.encode('UTF-8')
object_property_dict[property_id] = cell
cell_index += 1 cell_index += 1
if len(object_property_dict) > 0: if len(object_property_dict) > 0:
object_list.append(object_property_dict) object_list.append(object_property_dict)
table_dict[table_name.encode('UTF-8')] = object_list if six.PY2:
table_name = table_name.encode('UTF-8')
table_dict[table_name] = object_list
if len(table_dict.keys()) == 1: if len(table_dict.keys()) == 1:
return object_list return object_list
......
...@@ -53,12 +53,14 @@ def _validateFormToRequest(form, REQUEST, **kw): ...@@ -53,12 +53,14 @@ def _validateFormToRequest(form, REQUEST, **kw):
form.validate_all_to_request(REQUEST) form.validate_all_to_request(REQUEST)
validation_status = 0 validation_status = 0
validation_errors = None validation_errors = None
except FormValidationError as validation_errors: except FormValidationError as e:
## not all fields valid ## not all fields valid
validation_status = 1 validation_status = 1
except Exception as validation_errors: validation_errors = e
except Exception as e:
## missing fields ## missing fields
validation_status = 2 validation_status = 2
validation_errors = e
## extract form arguments and remove leading prefixes ## extract form arguments and remove leading prefixes
if validation_status == 0: if validation_status == 0:
for field in form.get_fields(): for field in form.get_fields():
......
# coding: utf-8 # coding: utf-8
import six
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
if context.getGlobalConfigurationAttr('categories_spreadsheet_configuration_save_relative_url'): if context.getGlobalConfigurationAttr('categories_spreadsheet_configuration_save_relative_url'):
...@@ -54,7 +55,10 @@ function_item_list = [ ...@@ -54,7 +55,10 @@ function_item_list = [
] ]
prefix = u"\N{NO-BREAK SPACE}" * 4
if six.PY2:
prefix = prefix.encode('utf-8')
return [['', '']] + [[ return [['', '']] + [[
(u"\N{NO-BREAK SPACE}" * 4 * depth ).encode('utf-8') + str(translateString(title)), ( prefix * depth ) + str(translateString(title)),
relative_url, relative_url,
] for (title, relative_url, depth) in function_item_list] ] for (title, relative_url, depth) in function_item_list]
...@@ -6,243 +6,243 @@ if context.getGlobalConfigurationAttr('categories_spreadsheet_configuration_save ...@@ -6,243 +6,243 @@ if context.getGlobalConfigurationAttr('categories_spreadsheet_configuration_save
return item_list_from_spreadsheet return item_list_from_spreadsheet
region_item_list = [ region_item_list = [
('Afghanistan', 'asia/southern_asia/afghanistan'), (b'Afghanistan', 'asia/southern_asia/afghanistan'),
('Albania', 'europe/southern_europe/albania'), (b'Albania', 'europe/southern_europe/albania'),
('Algeria', 'africa/northern_africa/algeria'), (b'Algeria', 'africa/northern_africa/algeria'),
('American Samoa', 'oceania/polynesia/american_samoa'), (b'American Samoa', 'oceania/polynesia/american_samoa'),
('Andorra', 'europe/southern_europe/andorra'), (b'Andorra', 'europe/southern_europe/andorra'),
('Angola', 'africa/middle_africa/angola'), (b'Angola', 'africa/middle_africa/angola'),
('Anguilla', 'americas/caribbean/anguilla'), (b'Anguilla', 'americas/caribbean/anguilla'),
('Antigua and Barbuda', 'americas/caribbean/antigua_and_barbuda'), (b'Antigua and Barbuda', 'americas/caribbean/antigua_and_barbuda'),
('Argentina', 'americas/south_america/argentina'), (b'Argentina', 'americas/south_america/argentina'),
('Armenia', 'asia/western_asia/armenia'), (b'Armenia', 'asia/western_asia/armenia'),
('Aruba', 'americas/caribbean/aruba'), (b'Aruba', 'americas/caribbean/aruba'),
('Australia', 'oceania/australia/australia'), (b'Australia', 'oceania/australia/australia'),
('Austria', 'europe/western_europe/austria'), (b'Austria', 'europe/western_europe/austria'),
('Azerbaijan', 'asia/western_asia/azerbaijan'), (b'Azerbaijan', 'asia/western_asia/azerbaijan'),
('Bahamas', 'americas/caribbean/bahamas'), (b'Bahamas', 'americas/caribbean/bahamas'),
('Bahrain', 'asia/western_asia/bahrain'), (b'Bahrain', 'asia/western_asia/bahrain'),
('Bangladesh', 'asia/southern_asia/bangladesh'), (b'Bangladesh', 'asia/southern_asia/bangladesh'),
('Barbados', 'americas/caribbean/barbados'), (b'Barbados', 'americas/caribbean/barbados'),
('Belarus', 'europe/eastern_europe/belarus'), (b'Belarus', 'europe/eastern_europe/belarus'),
('Belgium', 'europe/western_europe/belgium'), (b'Belgium', 'europe/western_europe/belgium'),
('Belize', 'americas/central_america/belize'), (b'Belize', 'americas/central_america/belize'),
('Benin', 'africa/western_africa/benin'), (b'Benin', 'africa/western_africa/benin'),
('Bermuda', 'americas/northern_america/bermuda'), (b'Bermuda', 'americas/northern_america/bermuda'),
('Bhutan', 'asia/southern_asia/bhutan'), (b'Bhutan', 'asia/southern_asia/bhutan'),
('Bolivia', 'americas/south_america/bolivia'), (b'Bolivia', 'americas/south_america/bolivia'),
('Bosnia and Herzegovina', 'europe/southern_europe/bosnia_and_herzegovina'), (b'Bosnia and Herzegovina', 'europe/southern_europe/bosnia_and_herzegovina'),
('Botswana', 'africa/southern_africa/botswana'), (b'Botswana', 'africa/southern_africa/botswana'),
('Brazil', 'americas/south_america/brazil'), (b'Brazil', 'americas/south_america/brazil'),
('British Virgin Islands', 'americas/caribbean/british_virgin_islands'), (b'British Virgin Islands', 'americas/caribbean/british_virgin_islands'),
('Brunei Darussalam', 'asia/south-eastern_asia/brunei_darussalam'), (b'Brunei Darussalam', 'asia/south-eastern_asia/brunei_darussalam'),
('Bulgaria', 'europe/eastern_europe/bulgaria'), (b'Bulgaria', 'europe/eastern_europe/bulgaria'),
('Burkina Faso', 'africa/western_africa/burkina_faso'), (b'Burkina Faso', 'africa/western_africa/burkina_faso'),
('Burundi', 'africa/eastern_africa/burundi'), (b'Burundi', 'africa/eastern_africa/burundi'),
('Cambodia', 'asia/south-eastern_asia/cambodia'), (b'Cambodia', 'asia/south-eastern_asia/cambodia'),
('Cameroon', 'africa/middle_africa/cameroon'), (b'Cameroon', 'africa/middle_africa/cameroon'),
('Canada', 'americas/northern_america/canada'), (b'Canada', 'americas/northern_america/canada'),
('Cape Verde', 'africa/western_africa/cape_verde'), (b'Cape Verde', 'africa/western_africa/cape_verde'),
('Cayman Islands', 'americas/caribbean/cayman_islands'), (b'Cayman Islands', 'americas/caribbean/cayman_islands'),
('Central African Republic', 'africa/middle_africa/central_african_republic'), (b'Central African Republic', 'africa/middle_africa/central_african_republic'),
('Chad', 'africa/middle_africa/chad'), (b'Chad', 'africa/middle_africa/chad'),
('Channel Islands', 'europe/northern_europe/channel_islands'), (b'Channel Islands', 'europe/northern_europe/channel_islands'),
('Chile', 'americas/south_america/chile'), (b'Chile', 'americas/south_america/chile'),
('China', 'asia/eastern_asia/china'), (b'China', 'asia/eastern_asia/china'),
('Colombia', 'americas/south_america/colombia'), (b'Colombia', 'americas/south_america/colombia'),
('Comoros', 'africa/eastern_africa/comoros'), (b'Comoros', 'africa/eastern_africa/comoros'),
('Congo', 'africa/middle_africa/congo'), (b'Congo', 'africa/middle_africa/congo'),
('Cook Islands', 'oceania/polynesia/cook_islands'), (b'Cook Islands', 'oceania/polynesia/cook_islands'),
('Costa Rica', 'americas/central_america/costa_rica'), (b'Costa Rica', 'americas/central_america/costa_rica'),
("Cote d'Ivoire", 'africa/western_africa/cote_diivoire'), (b"Cote d'Ivoire", 'africa/western_africa/cote_diivoire'),
('Croatia', 'europe/southern_europe/croatia'), (b'Croatia', 'europe/southern_europe/croatia'),
('Cuba', 'americas/caribbean/cuba'), (b'Cuba', 'americas/caribbean/cuba'),
('Cyprus', 'asia/western_asia/cyprus'), (b'Cyprus', 'asia/western_asia/cyprus'),
('Czech Republic', 'europe/eastern_europe/czech_republic'), (b'Czech Republic', 'europe/eastern_europe/czech_republic'),
("Democratic People's Republic of Korea", 'asia/eastern_asia/democratic_peoples_republic_of_korea'), (b"Democratic People's Republic of Korea", 'asia/eastern_asia/democratic_peoples_republic_of_korea'),
('Democratic Republic of the Congo', 'africa/middle_africa/democratic_republic_of_the_congo'), (b'Democratic Republic of the Congo', 'africa/middle_africa/democratic_republic_of_the_congo'),
('Denmark', 'europe/northern_europe/denmark'), (b'Denmark', 'europe/northern_europe/denmark'),
('Djibouti', 'africa/eastern_africa/djibouti'), (b'Djibouti', 'africa/eastern_africa/djibouti'),
('Dominica', 'americas/caribbean/dominica'), (b'Dominica', 'americas/caribbean/dominica'),
('Dominican Republic', 'americas/caribbean/dominican_republic'), (b'Dominican Republic', 'americas/caribbean/dominican_republic'),
('Ecuador', 'americas/south_america/ecuador'), (b'Ecuador', 'americas/south_america/ecuador'),
('Egypt', 'africa/northern_africa/egypt'), (b'Egypt', 'africa/northern_africa/egypt'),
('El Salvador', 'americas/central_america/el_salvador'), (b'El Salvador', 'americas/central_america/el_salvador'),
('Equatorial Guinea', 'africa/middle_africa/equatorial_guinea'), (b'Equatorial Guinea', 'africa/middle_africa/equatorial_guinea'),
('Eritrea', 'africa/eastern_africa/eritrea'), (b'Eritrea', 'africa/eastern_africa/eritrea'),
('Estonia', 'europe/northern_europe/estonia'), (b'Estonia', 'europe/northern_europe/estonia'),
('Ethiopia', 'africa/eastern_africa/ethiopia'), (b'Ethiopia', 'africa/eastern_africa/ethiopia'),
('Faeroe Islands', 'europe/northern_europe/faeroe_islands'), (b'Faeroe Islands', 'europe/northern_europe/faeroe_islands'),
('Falkland Islands (Malvinas)', 'americas/south_america/falkland_islands'), (b'Falkland Islands (Malvinas)', 'americas/south_america/falkland_islands'),
('Fiji', 'oceania/melanesia/fiji'), (b'Fiji', 'oceania/melanesia/fiji'),
('Finland', 'europe/northern_europe/finland'), (b'Finland', 'europe/northern_europe/finland'),
('France', 'europe/western_europe/france'), (b'France', 'europe/western_europe/france'),
('French Guiana', 'americas/south_america/french_guiana'), (b'French Guiana', 'americas/south_america/french_guiana'),
('French Polynesia', 'oceania/polynesia/french_polynesia'), (b'French Polynesia', 'oceania/polynesia/french_polynesia'),
('Gabon', 'africa/middle_africa/gabon'), (b'Gabon', 'africa/middle_africa/gabon'),
('Gambia', 'africa/western_africa/gambia'), (b'Gambia', 'africa/western_africa/gambia'),
('Georgia', 'asia/western_asia/georgia'), (b'Georgia', 'asia/western_asia/georgia'),
('Germany', 'europe/western_europe/germany'), (b'Germany', 'europe/western_europe/germany'),
('Ghana', 'africa/western_africa/ghana'), (b'Ghana', 'africa/western_africa/ghana'),
('Gibraltar', 'europe/southern_europe/gibraltar'), (b'Gibraltar', 'europe/southern_europe/gibraltar'),
('Greece', 'europe/southern_europe/greece'), (b'Greece', 'europe/southern_europe/greece'),
('Greenland', 'americas/northern_america/greenland'), (b'Greenland', 'americas/northern_america/greenland'),
('Grenada', 'americas/caribbean/grenada'), (b'Grenada', 'americas/caribbean/grenada'),
('Guadeloupe', 'americas/caribbean/guadeloupe'), (b'Guadeloupe', 'americas/caribbean/guadeloupe'),
('Guam', 'oceania/micronesia/guam'), (b'Guam', 'oceania/micronesia/guam'),
('Guatemala', 'americas/central_america/guatemala'), (b'Guatemala', 'americas/central_america/guatemala'),
('Guernsey', 'europe/northern_europe/guernsey'), (b'Guernsey', 'europe/northern_europe/guernsey'),
('Guinea', 'africa/western_africa/guinea'), (b'Guinea', 'africa/western_africa/guinea'),
('Guinea-Bissau', 'africa/western_africa/guinea-bissau'), (b'Guinea-Bissau', 'africa/western_africa/guinea-bissau'),
('Guyana', 'americas/south_america/guyana'), (b'Guyana', 'americas/south_america/guyana'),
('Haiti', 'americas/caribbean/haiti'), (b'Haiti', 'americas/caribbean/haiti'),
('Holy See', 'europe/southern_europe/holy_see'), (b'Holy See', 'europe/southern_europe/holy_see'),
('Honduras', 'americas/central_america/honduras'), (b'Honduras', 'americas/central_america/honduras'),
('Hong Kong Special Administrative Region of China', 'asia/eastern_asia/hong_kong'), (b'Hong Kong Special Administrative Region of China', 'asia/eastern_asia/hong_kong'),
('Hungary', 'europe/eastern_europe/hungary'), (b'Hungary', 'europe/eastern_europe/hungary'),
('Iceland', 'europe/northern_europe/iceland'), (b'Iceland', 'europe/northern_europe/iceland'),
('India', 'asia/southern_asia/india'), (b'India', 'asia/southern_asia/india'),
('Indonesia', 'asia/south-eastern_asia/indonesia'), (b'Indonesia', 'asia/south-eastern_asia/indonesia'),
('Iran, Islamic Republic of', 'asia/southern_asia/iran'), (b'Iran, Islamic Republic of', 'asia/southern_asia/iran'),
('Iraq', 'asia/western_asia/iraq'), (b'Iraq', 'asia/western_asia/iraq'),
('Ireland', 'europe/northern_europe/ireland'), (b'Ireland', 'europe/northern_europe/ireland'),
('Isle of Man', 'europe/northern_europe/isle_of_man'), (b'Isle of Man', 'europe/northern_europe/isle_of_man'),
('Israel', 'asia/western_asia/israel'), (b'Israel', 'asia/western_asia/israel'),
('Italy', 'europe/southern_europe/italy'), (b'Italy', 'europe/southern_europe/italy'),
('Jamaica', 'americas/caribbean/jamaica'), (b'Jamaica', 'americas/caribbean/jamaica'),
('Japan', 'asia/eastern_asia/japan'), (b'Japan', 'asia/eastern_asia/japan'),
('Jersey', 'europe/northern_europe/jersey'), (b'Jersey', 'europe/northern_europe/jersey'),
('Jordan', 'asia/western_asia/jordan'), (b'Jordan', 'asia/western_asia/jordan'),
('Kazakhstan', 'asia/central_asia/kazakhstan'), (b'Kazakhstan', 'asia/central_asia/kazakhstan'),
('Kenya', 'africa/eastern_africa/kenya'), (b'Kenya', 'africa/eastern_africa/kenya'),
('Kiribati', 'oceania/micronesia/kiribati'), (b'Kiribati', 'oceania/micronesia/kiribati'),
('Kuwait', 'asia/western_asia/kuwait'), (b'Kuwait', 'asia/western_asia/kuwait'),
('Kyrgyzstan', 'asia/central_asia/kyrgyzstan'), (b'Kyrgyzstan', 'asia/central_asia/kyrgyzstan'),
("Lao People's Democratic Republic", 'asia/south-eastern_asia/lao_peoples_democratic_republic'), (b"Lao People's Democratic Republic", 'asia/south-eastern_asia/lao_peoples_democratic_republic'),
('Latvia', 'europe/northern_europe/latvia'), (b'Latvia', 'europe/northern_europe/latvia'),
('Lebanon', 'asia/western_asia/lebanon'), (b'Lebanon', 'asia/western_asia/lebanon'),
('Lesotho', 'africa/southern_africa/lesotho'), (b'Lesotho', 'africa/southern_africa/lesotho'),
('Liberia', 'africa/western_africa/liberia'), (b'Liberia', 'africa/western_africa/liberia'),
('Libyan Arab Jamahiriya', 'africa/northern_africa/libyan_arab_jamahiriya'), (b'Libyan Arab Jamahiriya', 'africa/northern_africa/libyan_arab_jamahiriya'),
('Liechtenstein', 'europe/western_europe/liechtenstein'), (b'Liechtenstein', 'europe/western_europe/liechtenstein'),
('Lithuania', 'europe/northern_europe/lithuania'), (b'Lithuania', 'europe/northern_europe/lithuania'),
('Luxembourg', 'europe/western_europe/luxembourg'), (b'Luxembourg', 'europe/western_europe/luxembourg'),
('Macao Special Administrative Region of China', 'asia/eastern_asia/macao'), (b'Macao Special Administrative Region of China', 'asia/eastern_asia/macao'),
('Madagascar', 'africa/eastern_africa/madagascar'), (b'Madagascar', 'africa/eastern_africa/madagascar'),
('Malawi', 'africa/eastern_africa/malawi'), (b'Malawi', 'africa/eastern_africa/malawi'),
('Malaysia', 'asia/south-eastern_asia/malaysia'), (b'Malaysia', 'asia/south-eastern_asia/malaysia'),
('Maldives', 'asia/southern_asia/maldives'), (b'Maldives', 'asia/southern_asia/maldives'),
('Mali', 'africa/western_africa/mali'), (b'Mali', 'africa/western_africa/mali'),
('Malta', 'europe/southern_europe/malta'), (b'Malta', 'europe/southern_europe/malta'),
('Marshall Islands', 'oceania/micronesia/marshall_islands'), (b'Marshall Islands', 'oceania/micronesia/marshall_islands'),
('Martinique', 'americas/caribbean/martinique'), (b'Martinique', 'americas/caribbean/martinique'),
('Mauritania', 'africa/western_africa/mauritania'), (b'Mauritania', 'africa/western_africa/mauritania'),
('Mauritius', 'africa/eastern_africa/mauritius'), (b'Mauritius', 'africa/eastern_africa/mauritius'),
('Mayotte', 'africa/eastern_africa/mayotte'), (b'Mayotte', 'africa/eastern_africa/mayotte'),
('Mexico', 'americas/central_america/mexico'), (b'Mexico', 'americas/central_america/mexico'),
('Micronesia, Federated States of', 'oceania/micronesia/federated_states_of_micronesia'), (b'Micronesia, Federated States of', 'oceania/micronesia/federated_states_of_micronesia'),
('Monaco', 'europe/western_europe/monaco'), (b'Monaco', 'europe/western_europe/monaco'),
('Mongolia', 'asia/eastern_asia/mongolia'), (b'Mongolia', 'asia/eastern_asia/mongolia'),
('Montenegro', 'europe/southern_europe/montenegro'), (b'Montenegro', 'europe/southern_europe/montenegro'),
('Montserrat', 'americas/caribbean/montserrat'), (b'Montserrat', 'americas/caribbean/montserrat'),
('Morocco', 'africa/northern_africa/morocco'), (b'Morocco', 'africa/northern_africa/morocco'),
('Mozambique', 'africa/eastern_africa/mozambique'), (b'Mozambique', 'africa/eastern_africa/mozambique'),
('Myanmar', 'asia/south-eastern_asia/myanmar'), (b'Myanmar', 'asia/south-eastern_asia/myanmar'),
('Namibia', 'africa/southern_africa/namibia'), (b'Namibia', 'africa/southern_africa/namibia'),
('Nauru', 'oceania/micronesia/nauru'), (b'Nauru', 'oceania/micronesia/nauru'),
('Nepal', 'asia/southern_asia/nepal'), (b'Nepal', 'asia/southern_asia/nepal'),
('Netherlands', 'europe/western_europe/netherlands'), (b'Netherlands', 'europe/western_europe/netherlands'),
('Netherlands Antilles', 'americas/caribbean/netherlands_antilles'), (b'Netherlands Antilles', 'americas/caribbean/netherlands_antilles'),
('New Caledonia', 'oceania/melanesia/new_caledonia'), (b'New Caledonia', 'oceania/melanesia/new_caledonia'),
('New Zealand', 'oceania/australia/new_zealand'), (b'New Zealand', 'oceania/australia/new_zealand'),
('Nicaragua', 'americas/central_america/nicaragua'), (b'Nicaragua', 'americas/central_america/nicaragua'),
('Niger', 'africa/western_africa/niger'), (b'Niger', 'africa/western_africa/niger'),
('Nigeria', 'africa/western_africa/nigeria'), (b'Nigeria', 'africa/western_africa/nigeria'),
('Niue', 'oceania/polynesia/niue'), (b'Niue', 'oceania/polynesia/niue'),
('Norfolk Island', 'oceania/australia/norfolk_island'), (b'Norfolk Island', 'oceania/australia/norfolk_island'),
('Northern Mariana Islands', 'oceania/micronesia/northern_mariana_islands'), (b'Northern Mariana Islands', 'oceania/micronesia/northern_mariana_islands'),
('Norway', 'europe/northern_europe/norway'), (b'Norway', 'europe/northern_europe/norway'),
('Occupied Palestinian Territory', 'asia/western_asia/occupied_palestinian_territory'), (b'Occupied Palestinian Territory', 'asia/western_asia/occupied_palestinian_territory'),
('Oman', 'asia/western_asia/oman'), (b'Oman', 'asia/western_asia/oman'),
('Pakistan', 'asia/southern_asia/pakistan'), (b'Pakistan', 'asia/southern_asia/pakistan'),
('Palau', 'oceania/micronesia/palau'), (b'Palau', 'oceania/micronesia/palau'),
('Panama', 'americas/central_america/panama'), (b'Panama', 'americas/central_america/panama'),
('Papua New Guinea', 'oceania/melanesia/papua_new_guinea'), (b'Papua New Guinea', 'oceania/melanesia/papua_new_guinea'),
('Paraguay', 'americas/south_america/paraguay'), (b'Paraguay', 'americas/south_america/paraguay'),
('Peru', 'americas/south_america/peru'), (b'Peru', 'americas/south_america/peru'),
('Philippines', 'asia/south-eastern_asia/philippines'), (b'Philippines', 'asia/south-eastern_asia/philippines'),
('Pitcairn', 'oceania/polynesia/pitcairn'), (b'Pitcairn', 'oceania/polynesia/pitcairn'),
('Poland', 'europe/eastern_europe/poland'), (b'Poland', 'europe/eastern_europe/poland'),
('Portugal', 'europe/southern_europe/portugal'), (b'Portugal', 'europe/southern_europe/portugal'),
('Puerto Rico', 'americas/caribbean/puerto_rico'), (b'Puerto Rico', 'americas/caribbean/puerto_rico'),
('Qatar', 'asia/western_asia/qatar'), (b'Qatar', 'asia/western_asia/qatar'),
('Republic of Korea', 'asia/eastern_asia/republic_of_korea'), (b'Republic of Korea', 'asia/eastern_asia/republic_of_korea'),
('Republic of Moldova', 'europe/eastern_europe/republic_of_moldova'), (b'Republic of Moldova', 'europe/eastern_europe/republic_of_moldova'),
('Romania', 'europe/eastern_europe/romania'), (b'Romania', 'europe/eastern_europe/romania'),
('Russian Federation', 'europe/eastern_europe/russian_federation'), (b'Russian Federation', 'europe/eastern_europe/russian_federation'),
('Rwanda', 'africa/eastern_africa/rwanda'), (b'Rwanda', 'africa/eastern_africa/rwanda'),
('R\xc3\xa9union', 'africa/eastern_africa/reunion'), (b'R\xc3\xa9union', 'africa/eastern_africa/reunion'),
('Saint Helena', 'africa/western_africa/saint_helena'), (b'Saint Helena', 'africa/western_africa/saint_helena'),
('Saint Kitts and Nevis', 'americas/caribbean/saint_kitts_and_nevis'), (b'Saint Kitts and Nevis', 'americas/caribbean/saint_kitts_and_nevis'),
('Saint Lucia', 'americas/caribbean/saint_lucia'), (b'Saint Lucia', 'americas/caribbean/saint_lucia'),
('Saint Martin (French part)', 'americas/caribbean/saint_martin'), (b'Saint Martin (French part)', 'americas/caribbean/saint_martin'),
('Saint Pierre and Miquelon', 'americas/northern_america/saint_pierre_and_miquelon'), (b'Saint Pierre and Miquelon', 'americas/northern_america/saint_pierre_and_miquelon'),
('Saint Vincent and the Grenadines', 'americas/caribbean/saint_vincent_and_the_grenadines'), (b'Saint Vincent and the Grenadines', 'americas/caribbean/saint_vincent_and_the_grenadines'),
('Saint-Barth\xc3\xa9lemy', 'americas/caribbean/saint-barthelemy'), (b'Saint-Barth\xc3\xa9lemy', 'americas/caribbean/saint-barthelemy'),
('Samoa', 'oceania/polynesia/samoa'), (b'Samoa', 'oceania/polynesia/samoa'),
('San Marino', 'europe/southern_europe/san_marino'), (b'San Marino', 'europe/southern_europe/san_marino'),
('Sao Tome and Principe', 'africa/middle_africa/sao_tome_and_principe'), (b'Sao Tome and Principe', 'africa/middle_africa/sao_tome_and_principe'),
('Saudi Arabia', 'asia/western_asia/saudi_arabia'), (b'Saudi Arabia', 'asia/western_asia/saudi_arabia'),
('Senegal', 'africa/western_africa/senegal'), (b'Senegal', 'africa/western_africa/senegal'),
('Serbia', 'europe/southern_europe/serbia'), (b'Serbia', 'europe/southern_europe/serbia'),
('Seychelles', 'africa/eastern_africa/seychelles'), (b'Seychelles', 'africa/eastern_africa/seychelles'),
('Sierra Leone', 'africa/western_africa/sierra_leone'), (b'Sierra Leone', 'africa/western_africa/sierra_leone'),
('Singapore', 'asia/south-eastern_asia/singapore'), (b'Singapore', 'asia/south-eastern_asia/singapore'),
('Slovakia', 'europe/eastern_europe/slovakia'), (b'Slovakia', 'europe/eastern_europe/slovakia'),
('Slovenia', 'europe/southern_europe/slovenia'), (b'Slovenia', 'europe/southern_europe/slovenia'),
('Solomon Islands', 'oceania/melanesia/solomon_islands'), (b'Solomon Islands', 'oceania/melanesia/solomon_islands'),
('Somalia', 'africa/eastern_africa/somalia'), (b'Somalia', 'africa/eastern_africa/somalia'),
('South Africa', 'africa/southern_africa/south_africa'), (b'South Africa', 'africa/southern_africa/south_africa'),
('Spain', 'europe/southern_europe/spain'), (b'Spain', 'europe/southern_europe/spain'),
('Sri Lanka', 'asia/southern_asia/sri_lanka'), (b'Sri Lanka', 'asia/southern_asia/sri_lanka'),
('Sudan', 'africa/northern_africa/sudan'), (b'Sudan', 'africa/northern_africa/sudan'),
('Suriname', 'americas/south_america/suriname'), (b'Suriname', 'americas/south_america/suriname'),
('Svalbard and Jan Mayen Islands', 'europe/northern_europe/svalbard_and_jan_mayen_islands'), (b'Svalbard and Jan Mayen Islands', 'europe/northern_europe/svalbard_and_jan_mayen_islands'),
('Swaziland', 'africa/southern_africa/swaziland'), (b'Swaziland', 'africa/southern_africa/swaziland'),
('Sweden', 'europe/northern_europe/sweden'), (b'Sweden', 'europe/northern_europe/sweden'),
('Switzerland', 'europe/western_europe/switzerland'), (b'Switzerland', 'europe/western_europe/switzerland'),
('Syrian Arab Republic', 'asia/western_asia/syrian_arab_republic'), (b'Syrian Arab Republic', 'asia/western_asia/syrian_arab_republic'),
('Tajikistan', 'asia/central_asia/tajikistan'), (b'Tajikistan', 'asia/central_asia/tajikistan'),
('Thailand', 'asia/south-eastern_asia/thailand'), (b'Thailand', 'asia/south-eastern_asia/thailand'),
('The former Yugoslav Republic of Macedonia', 'europe/southern_europe/macedonia'), (b'The former Yugoslav Republic of Macedonia', 'europe/southern_europe/macedonia'),
('Timor-Leste', 'asia/south-eastern_asia/timor-leste'), (b'Timor-Leste', 'asia/south-eastern_asia/timor-leste'),
('Togo', 'africa/western_africa/togo'), (b'Togo', 'africa/western_africa/togo'),
('Tokelau', 'oceania/polynesia/tokelau'), (b'Tokelau', 'oceania/polynesia/tokelau'),
('Tonga', 'oceania/polynesia/tonga'), (b'Tonga', 'oceania/polynesia/tonga'),
('Trinidad and Tobago', 'americas/caribbean/trinidad_and_tobago'), (b'Trinidad and Tobago', 'americas/caribbean/trinidad_and_tobago'),
('Tunisia', 'africa/northern_africa/tunisia'), (b'Tunisia', 'africa/northern_africa/tunisia'),
('Turkey', 'asia/western_asia/turkey'), (b'Turkey', 'asia/western_asia/turkey'),
('Turkmenistan', 'asia/central_asia/turkmenistan'), (b'Turkmenistan', 'asia/central_asia/turkmenistan'),
('Turks and Caicos Islands', 'americas/caribbean/turks_and_caicos_islands'), (b'Turks and Caicos Islands', 'americas/caribbean/turks_and_caicos_islands'),
('Tuvalu', 'oceania/polynesia/tuvalu'), (b'Tuvalu', 'oceania/polynesia/tuvalu'),
('Uganda', 'africa/eastern_africa/uganda'), (b'Uganda', 'africa/eastern_africa/uganda'),
('Ukraine', 'europe/eastern_europe/ukraine'), (b'Ukraine', 'europe/eastern_europe/ukraine'),
('United Arab Emirates', 'asia/western_asia/united_arab_emirates'), (b'United Arab Emirates', 'asia/western_asia/united_arab_emirates'),
('United Kingdom of Great Britain and Northern Ireland', 'europe/northern_europe/united_kingdom'), (b'United Kingdom of Great Britain and Northern Ireland', 'europe/northern_europe/united_kingdom'),
('United Republic of Tanzania', 'africa/eastern_africa/united_republic_of_tanzania'), (b'United Republic of Tanzania', 'africa/eastern_africa/united_republic_of_tanzania'),
('United States Virgin Islands', 'americas/caribbean/united_states_virgin_islands'), (b'United States Virgin Islands', 'americas/caribbean/united_states_virgin_islands'),
('United States of America', 'americas/northern_america/united_states_of_america'), (b'United States of America', 'americas/northern_america/united_states_of_america'),
('Uruguay', 'americas/south_america/uruguay'), (b'Uruguay', 'americas/south_america/uruguay'),
('Uzbekistan', 'asia/central_asia/uzbekistan'), (b'Uzbekistan', 'asia/central_asia/uzbekistan'),
('Vanuatu', 'oceania/melanesia/vanuatu'), (b'Vanuatu', 'oceania/melanesia/vanuatu'),
('Venezuela (Bolivarian Republic of)', 'americas/south_america/venezuela'), (b'Venezuela (Bolivarian Republic of)', 'americas/south_america/venezuela'),
('Viet Nam', 'asia/south-eastern_asia/viet_nam'), (b'Viet Nam', 'asia/south-eastern_asia/viet_nam'),
('Wallis and Futuna Islands', 'oceania/polynesia/wallis_and_futuna_islands'), (b'Wallis and Futuna Islands', 'oceania/polynesia/wallis_and_futuna_islands'),
('Western Sahara', 'africa/northern_africa/western_sahara'), (b'Western Sahara', 'africa/northern_africa/western_sahara'),
('Yemen', 'asia/western_asia/yemen'), (b'Yemen', 'asia/western_asia/yemen'),
('Zambia', 'africa/eastern_africa/zambia'), (b'Zambia', 'africa/eastern_africa/zambia'),
('Zimbabwe', 'africa/eastern_africa/zimbabwe'), (b'Zimbabwe', 'africa/eastern_africa/zimbabwe'),
('\xc3\x85land Islands', 'europe/northern_europe/aland_islands'), (b'\xc3\x85land Islands', 'europe/northern_europe/aland_islands'),
] ]
return [['', '']] + [[str(translateString(title)), relative_url] for (title, relative_url) in region_item_list] return [['', '']] + [[str(translateString(title.decode('utf-8'))), relative_url] for (title, relative_url) in region_item_list]
...@@ -1981,11 +1981,8 @@ class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin): ...@@ -1981,11 +1981,8 @@ class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin):
def uploadFile(self, file_id): def uploadFile(self, file_id):
file_obj = getattr(self.portal, file_id) file_obj = getattr(self.portal, file_id)
file_path = tests_home + '/%s' % file_id file_path = tests_home + '/%s' % file_id
temp_file = open(file_path, 'w+b') with open(file_path, 'w+b') as temp_file:
try: temp_file.write(bytes(file_obj))
temp_file.write(str(file_obj))
finally:
temp_file.close()
return (file_path, FileUpload(file_path, file_id)) return (file_path, FileUpload(file_path, file_id))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment