swh.lister.core: Make gitlab lister a paging lister instance
Related T989
This commit is contained in:
parent
db36c499fe
commit
935b9cd24f
2 changed files with 120 additions and 15 deletions
|
@ -6,20 +6,14 @@ import random
|
|||
import re
|
||||
import time
|
||||
|
||||
from ..core.indexing_lister import SWHIndexingHttpLister
|
||||
from ..core.paging_lister import SWHPagingHttpLister
|
||||
from .models import GitLabModel
|
||||
|
||||
|
||||
class GitLabLister(SWHIndexingHttpLister):
|
||||
# Path to give and mentioning the last id for the next page
|
||||
class GitLabLister(SWHPagingHttpLister):
|
||||
# Template path expecting an integer that represents the page id
|
||||
PATH_TEMPLATE = '/projects?page=%d&order_by=id&sort=asc&simple=true'
|
||||
# gitlab api do not have an indexable identifier so using the page
|
||||
# id
|
||||
API_URL_INDEX_RE = re.compile(r'^.*/projects.*\&page=(\d+).*')
|
||||
# The indexable field, the one we are supposed to use in the api
|
||||
# query is not part of the lookup query. So, we cannot filter
|
||||
# (method filter_before_inject), nor detect and disable origins
|
||||
# (method disable_deleted_repo_tasks)
|
||||
MODEL = GitLabModel
|
||||
|
||||
@property
|
||||
|
@ -79,12 +73,6 @@ class GitLabLister(SWHIndexingHttpLister):
|
|||
params['auth'] = (auth['username'], auth['password'])
|
||||
return params
|
||||
|
||||
def filter_before_inject(self, models_list):
|
||||
"""We cannot filter so returns the models_list as is.
|
||||
|
||||
"""
|
||||
return models_list
|
||||
|
||||
def get_model_from_repo(self, repo):
|
||||
return {
|
||||
'instance': self.lister_name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue