Skip to content

Commit

Permalink
Merge pull request #230 from cloudblue/LITE-30249-product-exporting-t…
Browse files Browse the repository at this point in the history
…ypeerror

LITE-30249 Product exporting plugin fails with TypeError
  • Loading branch information
jazz-jack authored Jun 17, 2024
2 parents c2db1f8 + 2fef9c6 commit 99abc21
Show file tree
Hide file tree
Showing 4 changed files with 541 additions and 458 deletions.
9 changes: 6 additions & 3 deletions connect/cli/plugins/product/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def _build_f1_options(option_list):
return '"{options}"'.format(options=','.join(option_list))


def _primary_translation_str(trans):
return f'{trans["locale"]["id"]} ({trans["locale"]["name"]})' if trans else ''


def _setup_cover_sheet(ws, product, location, client, media_path):
ws.title = 'General Information'
ws.column_dimensions['A'].width = 50
Expand Down Expand Up @@ -118,9 +122,8 @@ def _setup_cover_sheet(ws, product, location, client, media_path):
.translations.filter(context__instance_id=product['id'], primary=True)
.first()
)
ws[
'B14'
].value = f'{ primary_translation["locale"]["id"] } ({ primary_translation["locale"]["name"] })'

ws['B14'].value = _primary_translation_str(primary_translation)

categories = client.categories.all()
unassignable_cat = ['Cloud Services', 'All Categories']
Expand Down
Loading

0 comments on commit 99abc21

Please sign in to comment.