Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

[8.0] TypeError: 'int' object has no attribute '__getitem__' on get_form_vals method #121

Open
livingmine opened this issue Aug 11, 2017 · 0 comments

Comments

@livingmine
Copy link

Impacted versions:
8.0

Steps to reproduce:
This has to do with selecting attribute with multi options selected. Select more than one attribute values on the multi attribute. This behaviour does not always happen, maybe it depends on the configuration on the product template.

Current behavior:
When debugging on get_form_vals method , The value of the dynamic_field is

{'__attribute-34': 2435, '__attribute-35': 1258,
 '__attribute-38': 1637, '__attribute-39': [[6, False, [2727]]], 
'__attribute-42': [[6, False, []]]}

The first iteration of for k, v in dynamic_fields.iteritems(): yields
k equals to __attribute-42 and v equals_to [[6, False, []]]
The second iteration of for k, v in dynamic_fields.iteritems(): yields
k equals to __attribute-39 and v equals_to [[6, False, [2727]]]

Strangely k equals to __attribute_39 appears again at the next iteration but this time with the v equals to [2727] in which accessing v[0][2] will produces an error of TypeError: 'int' object has no attribute '__getitem__'. What causes this key to appear again in the next iteration? My suspicion is that it is caused by dynamic_fields.update({k: value_ids}), after i postponed the update process to take place after the iteritems() is completed, things are working without any problems. @PCatinean can you please explain more about this method?

Expected behavior:
No errors occurred.

Video/Screenshot link (optional):
N/A

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant