Revision 44e0514f

b/pithos/api/tests.py
672 672
        r = self.update_object(self.account,
673 673
                                    self.container[0],
674 674
                                    self.obj[0]['name'],
675
                                    
676 675
                                    **meta)
677 676
        r = self.list_objects(self.account,
678 677
                          self.container[0],
b/pithos/api/util.py
79 79
def get_header_prefix(request, prefix):
80 80
    """Get all prefix-* request headers in a dict. Reformat keys with format_header_key()."""
81 81
    
82
    # TODO: Check that returned values are compliant with [\w-]+ regexp.
82 83
    prefix = 'HTTP_' + prefix.upper().replace('-', '_')
83 84
    # TODO: Document or remove '~' replacing.
84 85
    return dict([(format_header_key(k[5:]), v.replace('~', '')) for k, v in request.META.iteritems() if k.startswith(prefix) and len(k) > len(prefix)])
b/pithos/lib/hashfiler/noder.py
45 45
    return s
46 46

  
47 47
import re
48
_regexfilter = re.compile('(!?)\s*(\w+)\s*(=|!=|<=|>=|<|>)?\s*(.*)$')
48
_regexfilter = re.compile('(!?)\s*([\w-]+)\s*(=|!=|<=|>=|<|>)?\s*(.*)$', re.UNICODE)
49 49

  
50 50
_propnames = {
51 51
    'serial'    : 0,
......
235 235
        included = []
236 236
        excluded = []
237 237
        opers = []
238
        append = terms.append
239 238
        match = _regexfilter.match
240
        for term in terms:
241
            groups = match(term)
242
            if groups is None:
239
        for term in preterms:
240
            m = match(term)
241
            if m is None:
243 242
                continue
244
            neg, key, op, value = groups
243
            neg, key, op, value = m.groups()
245 244
            if neg:
246 245
                excluded.append(key)
247 246
            elif not value:
248 247
                included.append(key)
249
            else:
250
                opers.append(key, op, value)
251

  
248
            elif op:
249
                opers.append((key, op, value))
250
        
252 251
        return included, excluded, opers
253 252

  
254 253
    def construct_filters(self, filterq):
......
270 269
            append(subq)
271 270

  
272 271
        if opers:
273
            t = (("(key = %s and value %s %s)" % (o, v)) for o, v in opers)
272
            t = (("(key = %s and value %s %s)" % (k, o, v)) for k, o, v in opers)
274 273
            subq = "(" + ' or '.join(t) + ")"
275 274
            args += opers
276 275

  
......
343 342
        args = [parent, start, nextling, after, before, cluster]
344 343

  
345 344
        if filterq:
346
            subq, args = self.construct_filters(fitlerq)
345
            subq, subargs = self.construct_filters(filterq)
347 346
            if subq is not None:
348 347
                q += subq
349
                args += args
348
                args += subargs
350 349
        q += " order by path"
351 350

  
352 351
        if delimiter is None:
......
363 362
        pappend = prefixes.append
364 363
        matches = []
365 364
        mappend = matches.append
366

  
365
        
367 366
        execute(q, args)
368 367
        while 1:
369 368
            props = fetchone()

Also available in: Unified diff