[Cubicweb] some cubicweb goals for 2010
Sylvain Thénault
sylvain.thenault at logilab.fr
Mon Apr 26 12:36:36 CEST 2010
On 26 avril 12:24, Nicolas Chauvat wrote:
> Hi,
>
> what I would like to have is the ability to apply views to lists of
> objects, like:
>
> project = _cw.entity_from_eid(1234)
> tickets = project.reverse_done_in
> self.wview('table', tickets, 'null')
project = _cw.entity_from_eid(1234)
self.wview('table', project.related('done_in', 'object', 'null'))
> or the ability to get the RQL for a list of objects, like:
>
> project = _cw.entity_from_eid(1234)
> tickets = project.reverse_done_in
> self.build_url(rql=tickets.rql)
project = _cw.entity_from_eid(1234)
rset = project.related('done_in', 'object', 'null')
self.build_url(rql=rset.printable_rql())
> or make it easier to manipulate rql queries, like:
>
> project = _cw.entity_from_eid(1234)
> tickets = project.reverse_done_in
> rql = tickets.rql.add('T in_state "open"') # lots of open questions here
we already to such kind of things heavily, using the rql st api. There
are already high level methods to do things such as adding a restriction
(could be improved though).
project = _cw.entity_from_eid(1234)
rset = project.related('done_in', 'object', 'null')
union = rset.syntax_tree().children[0] # first Union node
self.add_constant_restriction(union.get_variable('X'), 'type', 'bug', 'String')
rql = union.as_string()
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
CubicWeb, the semantic web framework: http://www.cubicweb.org
More information about the Cubicweb
mailing list