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

configurator: py3

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