Skip to content

Commit

Permalink
release v0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
SenadI committed Aug 12, 2016
1 parent 600c0d4 commit a9f719e
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.4.2 (2016-08-12)
==================
- Bugfixes
- [Issue #16](https://github.com/sbg/sevenbridges-python/issues/16)
- [Issue #17](https://github.com/sbg/sevenbridges-python/issues/17)
- [Issue #18](https://github.com/sbg/sevenbridges-python/issues/18)

0.4.2 (2016-07-27)
==================
- Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
from setuptools import setup, find_packages

version = "0.4.2"
version = "0.4.3"

install_requires = []

Expand Down
2 changes: 1 addition & 1 deletion sevenbridges/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:license: Apache 2.0
"""

__version__ = "0.4.2"
__version__ = "0.4.3"

from sevenbridges.api import Api
from sevenbridges.config import Config
Expand Down
2 changes: 2 additions & 0 deletions sevenbridges/meta/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def get(cls, id, api=None):
:param api: sevenbridges Api instance.
:return: Resource object.
"""
if not id:
raise SbgError('Invalid id value!')
api = api if api else cls._API
if 'get' in cls._URL:
resource = api.get(url=cls._URL['get'].format(id=id)).json()
Expand Down
11 changes: 10 additions & 1 deletion sevenbridges/models/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import six

from sevenbridges.meta.resource import Resource
Expand All @@ -21,12 +22,20 @@ class App(Resource):
'raw': '/apps/{id}/raw'
}
href = HrefField()
id = StringField(read_only=True)
_id = StringField(read_only=True, name='id')
project = StringField(read_only=True)
name = StringField(read_only=True)
revision = IntegerField(read_only=True)
raw = DictField(read_only=False)

@property
def id(self):
_id, _rev = self._id.rsplit('/', 1)
if re.match('^\d*$', _rev):
return _id
else:
return self._id

def __str__(self):
return six.text_type('<App: id={id}>'.format(id=self.id))

Expand Down
5 changes: 4 additions & 1 deletion sevenbridges/models/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,15 @@ def query(cls, project=None, status=None, batch=None,
limit=limit, api=api)

@classmethod
def create(cls, name, project, app, batch_input=None, batch_by=None,
def create(cls, name, project, app, revision=None, batch_input=None, batch_by=None,
inputs=None, description=None, run=False, api=None):

"""
Creates a task on server.
:param name: Task name.
:param project: Project identifier.
:param app: CWL app identifier.
:param revision: CWL app revision.
:param batch_input: Batch input.
:param batch_by: Batch criteria.
:param inputs: Input map.
Expand All @@ -103,6 +104,8 @@ def create(cls, name, project, app, batch_input=None, batch_by=None,

project = Transform.to_project(project)
app = Transform.to_app(app)
if revision:
app = app + "/" + six.text_type(revision)

task_inputs = {'inputs': {}}
for k, v in inputs.items():
Expand Down
1 change: 1 addition & 0 deletions sevenbridges/tests/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ def app_can_be_copied(self, **kwargs):
app = self.default_app()
app['id'] = kwargs.pop('id')
app['name'] = kwargs.pop('new_name')
print(app['id'])
href = '/apps/{}/actions/copy'.format(app['id'])
self.request_mocker.request('POST', url=href, json=app)

Expand Down
2 changes: 1 addition & 1 deletion sevenbridges/tests/test_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_apps_get_revision(api, given, verifier):
verifier.app.app_fetched(app_id, app_revision)


@pytest.mark.parametrize("app_id", ['me/my-project', "me/my-project/1"])
@pytest.mark.parametrize("app_id", ["me/my-project/app"])
def test_app_copy(api, given, verifier, app_id):
# preconditions
copied_name = 'new-app'
Expand Down

0 comments on commit a9f719e

Please sign in to comment.