python3: access dictvalues as lists

This commit is contained in:
Frédéric Péters 2018-03-25 16:12:44 +02:00
parent 3a7f00da26
commit 98f3aac85a
4 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ from combo.utils import requests
def get_passerelle_service():
if hasattr(settings, 'KNOWN_SERVICES') and settings.KNOWN_SERVICES.get('passerelle'):
return settings.KNOWN_SERVICES['passerelle'].values()[0]
return list(settings.KNOWN_SERVICES['passerelle'].values())[0]
def is_family_enabled():
return get_passerelle_service() and hasattr(settings, 'FAMILY_SERVICE')

View File

@ -500,6 +500,6 @@ class TrackingCodeInputCell(CellBase):
def get_cell_extra_context(self, context):
extra_context = super(TrackingCodeInputCell, self).get_cell_extra_context(context)
if not self.wcs_site:
self.wcs_site = get_wcs_services().keys()[0]
self.wcs_site = list(get_wcs_services().keys())[0]
extra_context['url'] = get_wcs_services().get(self.wcs_site).get('url')
return extra_context

View File

@ -349,7 +349,7 @@ class Page(models.Model):
del cell['pk']
del cell['fields']['page']
cell['fields']['groups'] = [x[0] for x in cell['fields']['groups']]
for key in cell['fields'].keys():
for key in list(cell['fields'].keys()):
if key.startswith('cached_'):
del cell['fields'][key]
return serialized_page

View File

@ -237,7 +237,7 @@ class PageView(DetailView):
if 'data' in cell_type_groups.keys():
cell_type_groups[''] = cell_type_groups.get('data')
del cell_type_groups['data']
context['cell_type_groups'] = cell_type_groups.items()
context['cell_type_groups'] = list(cell_type_groups.items())
context['cell_type_groups'].sort(key=lambda x: x[0])
cells = CellBase.get_cells(page_id=self.object.id)