[Cubicweb] Proposal: new method ResultSet.one()

Christophe de Vienne cdevienne at gmail.com
Thu Dec 5 12:07:21 CET 2013


Le 04/12/2013 16:50, Denis Laxalde a écrit :
> Christophe de Vienne a écrit :
>> I propose to add a new method to ResultSet, named one(), that would
>> return exactly one entity from the resultset.
>> If more than one row and one column, or no row at all is found, an
>> exception would be raised.
>
> Request's find_one_entity method does something like that, even though
> you don't write RQL.
> http://docs.cubicweb.org/devweb/request.html#cubicweb.req.RequestSessionBase.find_one_entity
>

I did not know this one.

As you say, it is a little different to the one I propose because it is
both a helper to create a query and a way to retrieve the entity from
the result.


Christophe



More information about the Cubicweb mailing list