kontext
kontext copied to clipboard
0.9 branch Undo button feature
Expected: "Undoes" latest action
Result: Query failed: Syntax error at position 5. Please make sure the query and selected query type are correct.
The problems seems to be the following: Menu item is constructed as
self.query_undo = (
HideOnCustomCondItem(MainMenu.CONCORDANCE('undo'), _('Undo'), 'view')
.add_args(
('q', self._args['undo_q']))
.enable_if(lambda d: len(d.get('undo_q', [])) > 0)
)
when you mouseover the menu item the following code is executed
_createLink: function _createLink() {
if (this.props.data.url) {
return this.props.data.url;
} else if (this.props.data.action && typeof this.props.data.args === 'string') {
return this.createActionLink(this.props.data.action + '?' + this.props.data.args);
} else if (this.props.data.action) {
return this.createActionLink(this.props.data.action, this.props.data.args);
}
return undefined;
},
which creates url from e.g.,
this.props.data.action = "view"
this.props.data.args = Array(2) ("q", "q=aword%2C%5Blc%3D%22p%C5%99edem%22%5D")
like this
> http://localhost:5000/view?q=q%3Daword%252C%255Blc%253D%2522p%25C5%2599edem%2522%255D
(which is already strange because of all the other parameters from the original url).
This gets into python as
<type 'tuple'>: (u'q=aword%2C%5Blc%3D%22p%C5%99edem%22%5D',)
which ends with an expected exception
Query failed: Syntax error at position 5.