sbg / sevenbridges-python

SevenBridges Python Api bindings
Apache License 2.0
46 stars 27 forks source link

Cannot create project using billing_group.id parameter #11

Closed damirkrstanovic closed 8 years ago

damirkrstanovic commented 8 years ago

Environment - Python 2.7, miniconda, OSX, also reported to cause issues on Windows 7. Code to reproduce:

bgs = api.billing_groups.query(limit=1)
new_proj = api.projects.create(name='test123',billing_group=bgs[0].id)

Throws exception:

---------------------------------------------------------------------------
SbgError                                  Traceback (most recent call last)
<ipython-input-3-ea199f5c776e> in <module>()
----> 1 new_proj = api.projects.create(name='test123',billing_group=bgs[0].id)

/usr/local/lib/python2.7/site-packages/sevenbridges/models/project.pyc in create(cls, name, billing_group, description, tags, api)
     68         api = api if api else cls._API
     69
---> 70         billing_group = Transform.to_billing_group(billing_group)
     71         if name is None:
     72             raise SbgError('Project name is required!')

/usr/local/lib/python2.7/site-packages/sevenbridges/meta/transformer.pyc in to_billing_group(billing_group)
     73             return billing_group
     74         else:
---> 75             raise SbgError('Invalid billing group parameter!')
     76
     77     @staticmethod

SbgError: Invalid billing group parameter!

Both using string or BillingGroup object works without issues, but using billing_group.id causes this issue.

SenadI commented 8 years ago

Fixed in 0.4.1