← Back to team overview

ubuntu-sdk-bugs team mailing list archive

[Bug 1483614] [NEW] Retrieving a list of strings is seen as listmodel that can't be saved back

 

Public bug reported:

If you push a document that contains property being a list of strings,
like:

{
  'attachements': ["/path/to/foo1.png", "/path/to/foo2.png"]
}

Retrieving it is making the attachements a ListModel through the QML
type system (outside of u1db's scope thus). The ListModel contains
ObjectModel and it's useful to attach that to Repeater/Grid.

However, when we try to store those data back (from the same object), the ListModel/ObjectModel aren't storable in u1db, so we end up with:
{
  'attachments: [null, null]
}

So getting the object don't enable to save it back, we have to manually
typecast it and create some json objects from it, which is quite ugly
and cumbersome:
https://github.com/didrocks/splitthebill/commit/9d1e72131f7a2842bea08b4e144895ef0a06f4d2
#diff-63dd6639b235200e552147bf0a9003b8R59.

Any idea if u1db-qt can typecast it back to something that can be
stored, or anything to make the developer's life easier?

** Affects: u1db-qt
     Importance: Undecided
         Status: New

** Affects: u1db-qt (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: devexp

** Also affects: u1db-qt (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
SDK bug tracking, which is subscribed to u1db-qt in Ubuntu.
https://bugs.launchpad.net/bugs/1483614

Title:
  Retrieving a list of strings is seen as listmodel that can't be saved
  back

Status in U1DB Qt/ QML:
  New
Status in u1db-qt package in Ubuntu:
  New

Bug description:
  If you push a document that contains property being a list of strings,
  like:

  {
    'attachements': ["/path/to/foo1.png", "/path/to/foo2.png"]
  }

  Retrieving it is making the attachements a ListModel through the QML
  type system (outside of u1db's scope thus). The ListModel contains
  ObjectModel and it's useful to attach that to Repeater/Grid.

  However, when we try to store those data back (from the same object), the ListModel/ObjectModel aren't storable in u1db, so we end up with:
  {
    'attachments: [null, null]
  }

  So getting the object don't enable to save it back, we have to
  manually typecast it and create some json objects from it, which is
  quite ugly and cumbersome:
  https://github.com/didrocks/splitthebill/commit/9d1e72131f7a2842bea08b4e144895ef0a06f4d2
  #diff-63dd6639b235200e552147bf0a9003b8R59.

  Any idea if u1db-qt can typecast it back to something that can be
  stored, or anything to make the developer's life easier?

To manage notifications about this bug go to:
https://bugs.launchpad.net/u1db-qt/+bug/1483614/+subscriptions