← Back to team overview

touch-packages team mailing list archive

[Bug 1313673] Re: Category JSON parser expects string in render_template

 

** Project changed: unity-scopes-api => unity-scopes-api (Ubuntu)

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to unity-scopes-api in
Ubuntu.
https://bugs.launchpad.net/bugs/1313673

Title:
  Category JSON parser expects string in render_template

Status in “unity-scopes-api” package in Ubuntu:
  Triaged

Bug description:
  Working with remote scopes.

  This works when returned from server: (note escaped quotes in render_template value)
  {"category": {"icon": "FIXME", "id": "#ThanksOneDirectionForChangingOurLives", "render_template": "{\"schema-version\": 1, \"components\": {\"art\": \"icon_url\", \"summary\": \"text\", \"subtitle\": \"screen_name\", \"title\": \"name\"}, \"template\": {\"category-layout\": \"grid\", \"card-layout\": \"horizontal\"}}", "title": "#ThanksOneDirectionForChangingOurLives"}}
  <results here>

  Related Python code:
  TWEET_CATEGORY = { 
      'id': 'id',
      'title': 'Tweets',
      'render_template': json.dumps(TWEET_RENDERER),
      'icon': 'FIXME',
  }

  ---

  This does NOT work:
  {"category": {"icon": "FIXME", "id": "#ThanksOneDirectionForChangingOurLives", "render_template": {"schema-version": 1, "components": {"art": "icon_url", "summary": "text", "subtitle": "screen_name", "title": "name"}, "template": {"category-layout": "grid", "card-layout": "horizontal"}}, "title": "#ThanksOneDirectionForChangingOurLives"}}
  <results here>

  Related Python code:
  TWEET_CATEGORY = { 
      'id': 'id',
      'title': 'Tweets',
      'render_template': TWEET_RENDERER,
      'icon': 'FIXME',
  }

  where
  TWEET_RENDERER = { 
      'schema-version': 1,
      'template': {
          'category-layout': 'grid',
          'card-layout': 'horizontal'
      },  
      'components': {
          'title': 'name',
          'subtitle': 'screen_name',
          'art': 'icon_url',
          'summary': 'text',
      },  
  }

  It seems counter intuitive render_template is a JSON objec field value
  - a String containing quote-escaped JSON, instead of pure JSON.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unity-scopes-api/+bug/1313673/+subscriptions