Skip to content

Commit 6fe906d

Browse files
author
KP
committed
fix for issue where create() method returning the
wrong type and support new style classes. Fixed an issue where the create() method was returning a list instead of a dictionary. Support "new style" Python classes that inherit from object. More info at http://www.python.org/doc/newstyle/
1 parent 13ccc37 commit 6fe906d

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

README.mdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ Some useful direct links within this section are below:
2323
* [Reference: Filter Syntax](https://github.com/shotgunsoftware/python-api/wiki/Reference%3A-Filter-Syntax)
2424

2525
## Changelog
26+
**v3.0.4 - 2010 Nov 22**
27+
28+
+ fix for issue where create() method was returning list type instead of dictionary
29+
+ support new style classes (thanks to Alex Schworer https://github.com/schworer)
30+
2631
**v3.0.3 - 2010 Nov 12**
2732

2833
+ add support for local files. Injects convenience info into returned hash for local file links

shotgun_api3.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# https://support.shotgunsoftware.com/forums/48807-developer-api-info
3333
# ---------------------------------------------------------------------------------------------
3434

35-
__version__ = "3.0.3"
35+
__version__ = "3.0.4"
3636

3737
# ---------------------------------------------------------------------------------------------
3838
# SUMMARY
@@ -58,6 +58,10 @@
5858
# CHANGELOG
5959
# ---------------------------------------------------------------------------------------------
6060
"""
61+
+v3.0.4 - 2010 Nov 22
62+
+ fix for issue where create() method was returning list type instead of dictionary
63+
+ support new style classes (thanks to Alex Schworer https://github.com/schworer)
64+
6165
+v3.0.3 - 2010 Nov 12
6266
+ add support for local files. Injects convenience info into returned hash for local file links
6367
+ add support for authentication through http proxy server
@@ -153,7 +157,7 @@
153157
# ---------------------------------------------------------------------------------------------
154158
class ShotgunError(Exception): pass
155159

156-
class Shotgun:
160+
class Shotgun(object):
157161
# Used to split up requests into batches of records_per_page when doing requests. this helps speed tremendously
158162
# when getting lots of results back. doesn't affect the interface of the api at all (you always get the full set
159163
# of results back as one array) but just how the client class communicates with the server.
@@ -473,8 +477,8 @@ def create(self, entity_type, data, return_fields=None):
473477
args["fields"].append( {"field_name":f,"value":v} )
474478

475479
resp = self._api3.create(args)
476-
records = self._inject_field_values([resp["results"]])
477-
return records
480+
record = self._inject_field_values([resp["results"]])[0]
481+
return record
478482

479483
def update(self, entity_type, entity_id, data):
480484
"""
@@ -626,7 +630,7 @@ def schema(self, entity_type):
626630
def entity_types(self):
627631
raise ShotgunError("Deprecated: use schema_entity_read() instead")
628632

629-
class ShotgunCRUD:
633+
class ShotgunCRUD(object):
630634
def __init__(self, options):
631635
self.__sg_url = options['server_url']
632636
self.__auth_args = {'script_name': options['script_name'], 'script_key': options['script_key']}
@@ -735,7 +739,7 @@ def https_request(self, request):
735739
DSTOFFSET = STDOFFSET
736740
DSTDIFF = DSTOFFSET - STDOFFSET
737741

738-
class SgTimezone:
742+
class SgTimezone(object):
739743

740744
def __init__(self):
741745
self.utc = self.UTC()

0 commit comments

Comments
 (0)