|
6 | 6 | from six import text_type |
7 | 7 |
|
8 | 8 | from boxsdk.config import API |
9 | | -from boxsdk.object.collaboration import Collaboration |
10 | | -from boxsdk.object.file import File |
11 | 9 | from boxsdk.object.group import Group |
12 | 10 | from boxsdk.object.item import Item |
13 | 11 | from boxsdk.object.user import User |
@@ -217,7 +215,7 @@ def upload_stream( |
217 | 215 | box_response = self._session.post(url, data=data, files=files, expect_json_response=False) |
218 | 216 | file_response = box_response.json()['entries'][0] |
219 | 217 | file_id = file_response['id'] |
220 | | - return File( |
| 218 | + return Translator().translate(file_response['type'])( |
221 | 219 | session=self._session, |
222 | 220 | object_id=file_id, |
223 | 221 | response_object=file_response, |
@@ -296,7 +294,7 @@ def create_subfolder(self, name): |
296 | 294 | } |
297 | 295 | box_response = self._session.post(url, data=json.dumps(data)) |
298 | 296 | response = box_response.json() |
299 | | - return Folder( |
| 297 | + return self.__class__( |
300 | 298 | session=self._session, |
301 | 299 | object_id=response['id'], |
302 | 300 | response_object=response, |
@@ -359,7 +357,7 @@ def add_collaborator(self, collaborator, role, notify=False): |
359 | 357 | box_response = self._session.post(url, expect_json_response=True, data=data, params=params) |
360 | 358 | collaboration_response = box_response.json() |
361 | 359 | collab_id = collaboration_response['id'] |
362 | | - return Collaboration( |
| 360 | + return Translator().translate(collaboration_response['type'])( |
363 | 361 | session=self._session, |
364 | 362 | object_id=collab_id, |
365 | 363 | response_object=collaboration_response, |
|
0 commit comments