Edgewall Software

Ticket #5998: query.diff

File query.diff, 2.4 KB (added by me@…, 4 years ago)

[patch] use this one.

  • query.py

    (this hunk was shorter than expected) 
    690690                'groups': groupsequence or [(None, tickets)], 
    691691                'last_group_is_partial': last_group_is_partial, 
    692692                'paginator': results} 
    693      
     693                 
     694    def get_parameters(self): 
     695       # this is a workaround for a bug that arises because the request argument is called "row"  
     696       #but the query language syntax expects "rows" 
     697        
     698       if self.constraints.has_key('row'): 
     699                self.rows = self.constraints['row'] 
     700                del self.constraints['row'] 
     701        
     702       return {'constraints':self.constraints, 
     703                'col': self.cols, 
     704                'order':self.order, 
     705                'desc':self.desc, 
     706                'group': self.group, 
     707                'groupdesc':self.groupdesc, 
     708                'row': self.rows, 
     709                'page':self.page, 
     710                'max':self.max} 
     711        
     
    759777                user = email or name or None  
    760778                       
    761779            if user:  
    762                 qstring = qstring.replace('$USER', user)  
    763             self.log.debug('QueryModule: Using default query: %s', str(qstring))  
    764             constraints = Query.from_string(self.env, qstring).constraints  
    765             # Ensure no field constraints that depend on $USER are used  
     780                qstring = qstring.replace('$USER', user) 
     781             
     782            self.log.debug('QueryModule: Using default query: %s', str(qstring)) 
     783            default_query = Query.from_string(self.env, qstring) 
     784             
     785            constraints = default_query.constraints 
     786                       
     787            # rather than screw around with additional tests all down the line, we'll 
     788            # just put fake "arguments" into the request object 
     789            for field, value in default_query.get_parameters().items(): 
     790                if not req.args.has_key(field): 
     791                        req.args[field] = value 
     792             
     793                # Ensure no field constraints that depend on $USER are used  
    766794            # if we have no username.  
     795 
    767796            for field, vals in constraints.items():  
    768797                for val in vals:  
    769798                    if val.endswith('$USER'):  
    770                         del constraints[field]  
    771  
     799                        del constraints[field] 
     800                 
     801