osclib/stagingapi: get_staging_projects(): utilize project_list_prefix().
This commit is contained in:
parent
df2fd398e0
commit
b1ec7efb3c
@ -49,6 +49,7 @@ from osc.core import streamfile
|
||||
|
||||
from osclib.cache import Cache
|
||||
from osclib.core import devel_project_get
|
||||
from osclib.core import project_list_prefix
|
||||
from osclib.comments import CommentAPI
|
||||
from osclib.ignore_command import IgnoreCommand
|
||||
from osclib.memoize import memoize
|
||||
@ -333,17 +334,10 @@ class StagingAPI(object):
|
||||
:return list of known staging projects
|
||||
"""
|
||||
|
||||
projects = []
|
||||
projects = project_list_prefix(self.apiurl, self.cstaging + ':')
|
||||
if not include_dvd:
|
||||
projects = filter(lambda p: not p.endswith(':DVD'), projects)
|
||||
|
||||
query = "id?match=starts-with(@name,'{}:')".format(self.cstaging)
|
||||
url = self.makeurl(['search', 'project', query])
|
||||
projxml = http_GET(url)
|
||||
root = ET.parse(projxml).getroot()
|
||||
for val in root.findall('project'):
|
||||
project = val.get('name')
|
||||
if not include_dvd and project.endswith(':DVD'):
|
||||
continue
|
||||
projects.append(project)
|
||||
return projects
|
||||
|
||||
def extract_staging_short(self, p):
|
||||
|
@ -19,6 +19,7 @@ import os
|
||||
import re
|
||||
import string
|
||||
import time
|
||||
import urllib
|
||||
import urllib2
|
||||
import urlparse
|
||||
import xml.etree.cElementTree as ET
|
||||
@ -810,7 +811,8 @@ class OBS(object):
|
||||
@GET('/search/project/id')
|
||||
def search_project_id(self, request, uri, headers):
|
||||
"""Return a search result /search/project/id."""
|
||||
assert urlparse.urlparse(uri).query == "match=starts-with(@name,'openSUSE:Factory:Staging:')"
|
||||
assert urlparse.urlparse(uri).query == urllib.urlencode(
|
||||
{'match': 'starts-with(@name, "openSUSE:Factory:Staging:")'})
|
||||
|
||||
response = (404, headers, '<result>Not found</result>')
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user