Skip to content

Commit

Permalink
Merge branch 'feature/zero' into 'develop'
Browse files Browse the repository at this point in the history
Feature/zero

See merge request core/sevenbridges-python!56
  • Loading branch information
Dejan Knezevic committed Jan 23, 2020
2 parents a704e37 + b8fd7e3 commit 06be8c3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sevenbridges/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def __init__(self, profile=None, proxies=None, advance_access=None):
logger.info(
'Client settings: [url={}] [token={}] [proxy={}]'.format(
self.api_endpoint,
self.auth_token,
'*****',
self.proxies
)
)
8 changes: 8 additions & 0 deletions sevenbridges/meta/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
logger = logging.getLogger(__name__)


DEFAULT_LIMIT = 100


# noinspection PyProtectedMember
class ResourceMeta(type):
"""
Expand Down Expand Up @@ -131,6 +134,11 @@ def _query(cls, **kwargs):

api = kwargs.pop('api', cls._API)
url = kwargs.pop('url')

# Check for valid limit value
if kwargs.get('limit') is not None and kwargs['limit'] <= 0:
kwargs['limit'] = DEFAULT_LIMIT

extra = {'resource': cls.__name__, 'query': kwargs}
logger.info('Querying {} resource'.format(cls), extra=extra)
response = api.get(url=url, params=kwargs)
Expand Down
9 changes: 6 additions & 3 deletions sevenbridges/models/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ def __ne__(self, other):
return not self.__eq__(other)

def __str__(self):
return six.text_type('<App: id={id} rev={rev}>'.format(
id=self.id, rev=self.revision)
)
revision = self.field('revision')
if revision:
return six.text_type('<App: id={id} rev={rev}>'.format(
id=self.id, rev=revision)
)
return six.text_type('<App: id={id}'.format(id=self.id))

@classmethod
def query(cls, project=None, visibility=None, q=None, id=None, offset=None,
Expand Down

0 comments on commit 06be8c3

Please sign in to comment.