diff --git a/pyteamcity/future/build.py b/pyteamcity/future/build.py index 0402c89..7b0a08e 100644 --- a/pyteamcity/future/build.py +++ b/pyteamcity/future/build.py @@ -54,6 +54,10 @@ def finish_date(self): def agent(self): return Agent.from_dict(self._data_dict.get('agent')) + @property + def web_url(self): + return self._data_dict['webUrl'] + @property def build_type(self): return BuildTypeQuerySet(self.teamcity).get(id=self.build_type_id) @@ -220,7 +224,7 @@ def filter(self, since_build=None, since_date=None, status=None, agent_name=None, personal=None, canceled=None, failed_to_start=None, running=None, - start=None, count=None, lookup_limit=None): + start=None, count=None, lookup_limit=None, default_filter=None): if id is not None: self._add_pred('id', id) if project is not None: @@ -264,6 +268,8 @@ def filter(self, self._add_pred('count', count) if lookup_limit is not None: self._add_pred('lookupLimit', lookup_limit) + if default_filter is not None: + self._add_pred('defaultFilter', default_filter) return self def _get_since_date(self, since_date): diff --git a/pyteamcity/future/core/queryset.py b/pyteamcity/future/core/queryset.py index d63b3d9..f4c7184 100644 --- a/pyteamcity/future/core/queryset.py +++ b/pyteamcity/future/core/queryset.py @@ -21,7 +21,7 @@ def _add_pred(self, name, value): def _get_url(self, details=False, href=None): if href is not None: - return 'http://' + self.teamcity.server + href + return self.teamcity.base_url + href url = self.base_url @@ -60,6 +60,27 @@ def _data(self, details=False, href=None): return self._data_dict + def fetch_all(self): + if self._data_dict: + return + href = None + while href != -1: + # self._locator.page = (start, 50) + page = self._fetch(href=href) + for key, value in page.items(): + if key in self._data_dict: + if isinstance(value, list): + self._data_dict[key].extend(value) + elif isinstance(value, int): + self._data_dict[key] += value + else: + self._data_dict[key] = value + href = page.get('nextHref', -1) + for key, value in self._data_dict.items(): + if isinstance(value, int): + setattr(self, key, value) + return self + @classmethod def _from_dict(cls, d, query_set): return cls._entity_factory.from_dict(d, query_set)