← Back to team overview

touch-packages team mailing list archive

[Bug 1313673] [NEW] Category JSON parser expects string in render_template

 

You have been subscribed to a public bug:

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.

** Affects: unity-scopes-api (Ubuntu)
     Importance: Undecided
         Status: Triaged


** Tags: scope-dev
-- 
Category JSON parser expects string in render_template
https://bugs.launchpad.net/bugs/1313673
You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to unity-scopes-api in Ubuntu.