Edgewall Software

Ticket #5998: query.2.patch

File query.2.patch, 2.0 KB (added by Stephen Prater <me@…>, 4 years ago)
  • query.py

     
    686686                'last_group_is_partial': last_group_is_partial, 
    687687                'paginator': results} 
    688688     
     689    def get_parameters(self): 
     690        #this is a workaround for a bug that arises because the request argument is called "row"  
     691        #but the query language syntax expects "rows" 
     692        if self.constraints.has_key('row'): 
     693            self.rows = self.constraints['row'] 
     694            del self.constraints['row'] 
     695        
     696        param = {'constraints':self.constraints, 
     697                 'col': self.cols, 
     698                 'order':self.order, 
     699                 'group': self.group, 
     700                 'row': self.rows, 
     701                 'page':self.page, 
     702                 'max':self.max} 
     703        if self.desc: 
     704            param['desc'] = True 
     705        if self.groupdesc: 
     706            param['groupdesc'] = True 
     707        
     708       return param 
     709 
     710 
    689711class QueryModule(Component): 
    690712 
    691713    implements(IRequestHandler, INavigationContributor, IWikiSyntaxProvider, 
     
    756778            if user:  
    757779                qstring = qstring.replace('$USER', user)  
    758780            self.log.debug('QueryModule: Using default query: %s', str(qstring))  
    759             constraints = Query.from_string(self.env, qstring).constraints  
     781            default_query = Query.from_string(self.env, qstring) 
     782            constraints = default_query.constraints 
     783            # rather than screw around with additional tests all down the line, we'll 
     784            # just put fake "arguments" into the request object 
     785            for field, value in default_query.get_parameters().items(): 
     786                if not req.args.has_key(field): 
     787                    req.args[field] = value 
    760788            # Ensure no field constraints that depend on $USER are used  
    761789            # if we have no username.  
    762790            for field, vals in constraints.items():