--- a/ChangeLog Fri Jun 10 08:04:00 2011 +0200
+++ b/ChangeLog Fri Jul 01 12:08:52 2011 +0200
@@ -2,11 +2,15 @@
=================
--
-* support != operator for non equality
-* support for CAST function
-* support for regexp-based pattern matching using a REGEXP operator
-* may now GROUPBY functions / column number
-* fix parsing of negative float
+
+ * fix remove_group_var renamed into remove_group_term and fixed implementation
+
+2011-06-09 -- 0.29.0
+ * support != operator for non equality
+ * support for CAST function
+ * support for regexp-based pattern matching using a REGEXP operator
+ * may now GROUPBY functions / column number
+ * fix parsing of negative float
2011-01-12 -- 0.28.0
* enhance rewrite_shared_optional so one can specify where the new identity
--- a/nodes.py Fri Jun 10 08:04:00 2011 +0200
+++ b/nodes.py Fri Jul 01 12:08:52 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2004-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2004-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of rql.
--- a/parser.g Fri Jun 10 08:04:00 2011 +0200
+++ b/parser.g Fri Jul 01 12:08:52 2011 +0200
@@ -1,7 +1,7 @@
"""yapps input grammar for RQL.
:organization: Logilab
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
--- a/stmts.py Fri Jun 10 08:04:00 2011 +0200
+++ b/stmts.py Fri Jul 01 12:08:52 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2004-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2004-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of rql.
@@ -27,6 +27,7 @@
from warnings import warn
from logilab.common.decorators import cached
+from logilab.common.deprecation import deprecated
from rql import BadRQLQuery, CoercionError, nodes
from rql.base import BaseNode, Node
@@ -708,7 +709,7 @@
elif node in self.orderby:
self.remove_sort_term(node)
elif node in self.groupby:
- self.remove_group_var(node)
+ self.remove_group_term(node)
elif node in self.having:
self.having.remove(node)
# XXX selection
@@ -730,7 +731,7 @@
elif isinstance(vref.parent, nodes.SortTerm):
self.remove_sort_term(vref.parent)
elif vref in self.groupby:
- self.remove_group_var(vref)
+ self.remove_group_term(vref)
else: # selected variable
self.remove_selected(vref)
# effective undefine operation
@@ -796,17 +797,19 @@
from rql.undo import AddGroupOperation
self.undo_manager.add_operation(AddGroupOperation(vref))
- def remove_group_var(self, vref):
+ def remove_group_term(self, term):
"""remove the group variable and the group node if necessary"""
if self.should_register_op:
from rql.undo import RemoveGroupOperation
- self.undo_manager.add_operation(RemoveGroupOperation(vref))
- vref.unregister_reference()
- self.groupby.remove(vref)
+ self.undo_manager.add_operation(RemoveGroupOperation(term))
+ for vref in term.iget_nodes(nodes.VariableRef):
+ vref.unregister_reference()
+ self.groupby.remove(term)
+ remove_group_var = deprecated('[rql 0.29] use remove_group_term instead')(remove_group_term)
def remove_groups(self):
for vref in self.groupby[:]:
- self.remove_group_var(vref)
+ self.remove_group_term(vref)
def add_sort_var(self, var, asc=True):
"""add var in 'orderby' constraints
--- a/test/unittest_nodes.py Fri Jun 10 08:04:00 2011 +0200
+++ b/test/unittest_nodes.py Fri Jul 01 12:08:52 2011 +0200
@@ -1,5 +1,5 @@
# -*- coding: iso-8859-1 -*-
-# copyright 2004-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2004-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of rql.
@@ -232,11 +232,11 @@
tree.check_references()
self.assertEqual(tree.as_string(), 'Any X')
- def test_select_remove_group_var(self):
+ def test_select_remove_group_term(self):
tree = self._parse('Any X GROUPBY X')
tree.save_state()
select = tree.children[0]
- select.remove_group_var(select.groupby[0])
+ select.remove_group_term(select.groupby[0])
tree.check_references()
self.assertEqual(tree.as_string(), 'Any X')
tree.recover()
--- a/test/unittest_parser.py Fri Jun 10 08:04:00 2011 +0200
+++ b/test/unittest_parser.py Fri Jul 01 12:08:52 2011 +0200
@@ -1,5 +1,5 @@
# -*- coding: iso-8859-1 -*-
-# copyright 2004-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2004-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of rql.
--- a/undo.py Fri Jun 10 08:04:00 2011 +0200
+++ b/undo.py Fri Jul 01 12:08:52 2011 +0200
@@ -196,7 +196,7 @@
def undo(self, selection):
"""undo the operation on the selection"""
- self.stmt.remove_group_var(self.node)
+ self.stmt.remove_group_term(self.node)
class RemoveGroupOperation(NodeOperation):
"""Defines how to undo 'remove group'."""