Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. raw = {}
  2.  
  3. for item in array.values():
  4.     raw.update({
  5.         item.get('attributeId') : {
  6.             'id' : item.get('attributeId'),
  7.             'title' : item.get('title'),
  8.             'code' : item.get('code'),
  9.             'showInSpecList' : item.get('showInSpecList'),
  10.             'description' : item.get('description'),
  11.             'attributeGroupId' : item.get('attributeGroupId'),
  12.             'cssClass' : item.get('cssClass'),
  13.  
  14.             'attributeValues': {
  15.                 'id' : item.get('id'),
  16.                 'value' : item.get('value'),
  17.                 'title' : item.get('valueTitle'),
  18.                 'cssClass': item.get('valueCssClass')
  19.             }
  20.         }
  21.     })
  22.  
  23. mapper = AttributesMapper()
  24. result = {}
  25.  
  26. print(type(raw)) # - <class 'dict'>
  27. for item in raw.items():
  28.     print(type(item))  # - <class 'tuple'>
  29.     result.update(mapper.createObject(item))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement