Package pulp :: Package server :: Package webservices :: Module mongo
[hide private]
[frames] | no frames]

Source Code for Module pulp.server.webservices.mongo

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  # 
 4  # Copyright © 2010 Red Hat, Inc. 
 5  # 
 6  # This software is licensed to you under the GNU General Public License, 
 7  # version 2 (GPLv2). There is NO WARRANTY for this software, express or 
 8  # implied, including the implied warranties of MERCHANTABILITY or FITNESS 
 9  # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 
10  # along with this software; if not, see 
11  # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 
12  # 
13  # Red Hat trademarks are not licensed under GPLv2. No permission is 
14  # granted to use or replicate Red Hat trademarks that are incorporated 
15  # in this software or its documentation. 
16   
17  """ 
18  Mongo utility module to help pulp web services deal with the mongo db. 
19  """ 
20   
21  import re 
22   
23   
24 -def filters_to_re_spec(filters):
25 """ 26 @type filters: dict of str: list 27 @param filters: http request query parameters 28 @return: dict of field: regex of possible str values 29 """ 30 if not filters: 31 return None 32 return dict((k, re.compile('(%s)' % '|'.join(v))) for k,v in filters.items())
33