Show a View instead of a RecordType in a CouchGrid

Bug #546579 reported by José Ernesto Dávila Pantoja
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Quickly Widgets
New
Undecided
Unassigned

Bug Description

It would be a great feature to be able to show a DesktopCouch View instead of a RecordType in a CouchGrid. Right now you can do this:

keys = ["nombre", "email", "distro"]
record_type = "http://people.ubuntu.com/~josernestodavila/couch/PizzaBashLogDoc"
self.couchgrid = CouchGrid("pizzabashlog", record_type = record_type, keys = keys)
self.couchgrid.show()

I would like to do something like:

if not self.database.view_exists("asistencia_mensual", "pizzabashlog"):
    viewfn = 'function (doc){ emit([doc.mes], doc);}'
    self.database.add_view("asistencia_mensual", viewfn, None, "pizzabashlog")

results = self.database.execute_view("asistencia_mensual", "pizzabashlog")

keys = ["nombre", "email", "distro"]
record_type = "http://people.ubuntu.com/~josernestodavila/couch/PizzaBashLogDoc"
self.couchgrid = CouchGrid("pizzabashlog", record_type = record_type, keys = keys, records = results)
self.couchgrid.show()

There should be a better way to pass the results to the CouchGrid, but I just started with Python and I'm not pretty sure the right way to implement it, maybe passing the View name instead of the record_type and not passing the extra parameter to the constructor.

description: updated
Revision history for this message
Jo-Erlend Schinstad (joerlend.schinstad-deactivatedaccount) wrote :

You're onto something, but I'm not entirely sure if I'd do it exactly like that. I'm going to have a look at some of these things in the not-too-distant future.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.