[Cubicweb] some cubicweb goals for 2010
Nicolas Chauvat
nicolas.chauvat at logilab.fr
Mon Apr 26 13:19:39 CEST 2010
Syvlain,
Your time-machine seems to work really well. Would you lend it to me ?
I have a couple things I would like to fix in my past.
On Mon, Apr 26, 2010 at 12:36:36PM +0200, Sylvain Thénault wrote:
> > 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'))
Shouldn't project.reverse_done_in return the same thing as
project.related(..) then ?
> self.build_url(rql=rset.printable_rql())
http://www.cubicweb.org/doc/en/development/devcore/dbapi
Ok, I will read the fine manual.
> > 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()
This would deserve a proper thread, but here are a couple comments:
* does rset.syntax_tree() really need to be a method ?
* does self.add_constant_restriction(...) really have to be a method
of self, I would expect to find it on the syntax_tree object or on
a RQLHandler object that would manipulate the syntax_tree as in
project = _cw.entity_from_eid(1234)
rset = project.related('done_in', 'object', 'null')
tree = rset.syntax_tree
tree.add_constant_restriction(tree.children[0].get_variable('X'), 'type', 'bug', 'String')
rql = tree.as_string()
or
project = _cw.entity_from_eid(1234)
rset = project.related('done_in', 'object', 'null')
handler = RQLHandler(rset.syntax_tree)
handler.add_constant_restriction(tree.children[0].get_variable('X'), 'type', 'bug', 'String')
rql = tree.as_string()
--
Nicolas Chauvat
logilab.fr - services en informatique scientifique et gestion de connaissances
More information about the Cubicweb
mailing list