If an object is passed as a parameter, extract its ID.
This allows things like: photos = client.photos.list() client.photos.delete(photos)
This commit is contained in:
parent
21c38c53cb
commit
fafeb70ec1
7 changed files with 53 additions and 28 deletions
|
@ -1,4 +1,4 @@
|
|||
from openphoto_http import OpenPhotoHttp, OpenPhotoError
|
||||
from errors import *
|
||||
from objects import Tag
|
||||
|
||||
class ApiTags:
|
||||
|
@ -21,13 +21,13 @@ class ApiTag:
|
|||
|
||||
def delete(self, tag, **kwds):
|
||||
""" Delete a tag """
|
||||
tag = Tag(self._client, {"id": tag})
|
||||
if not isinstance(tag, Tag):
|
||||
tag = Tag(self._client, {"id": tag})
|
||||
tag.delete(**kwds)
|
||||
|
||||
def update(self, tag, **kwds):
|
||||
""" Update a tag """
|
||||
tag = Tag(self._client, {"id": tag})
|
||||
if not isinstance(tag, Tag):
|
||||
tag = Tag(self._client, {"id": tag})
|
||||
tag.update(**kwds)
|
||||
return tag
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue