Skip to content

Commit 345f848

Browse files
ben-reillysujaygarlanka
authored andcommitted
Rename upload method parameters to align with API (#481)
1 parent 17cd659 commit 345f848

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

boxsdk/object/file.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def update_contents_with_stream(
200200
preflight_expected_size=0,
201201
upload_using_accelerator=False,
202202
file_name=None,
203-
file_modified_at=None,
203+
content_modified_at=None,
204204
additional_attributes=None,
205205
):
206206
"""
@@ -236,9 +236,9 @@ def update_contents_with_stream(
236236
The new name to give the file on Box.
237237
:type file_name:
238238
`unicode` or None
239-
:param file_modified_at:
240-
The RFC-3339 datetime when the file was last modified.
241-
:type file_modified_at:
239+
:param content_modified_at:
240+
The RFC-3339 datetime when the file content was last modified.
241+
:type content_modified_at:
242242
`unicode` or None
243243
:param additional_attributes:
244244
A dictionary containing attributes to add to the file that are not covered by other parameters.
@@ -268,7 +268,7 @@ def update_contents_with_stream(
268268

269269
attributes = {
270270
'name': file_name,
271-
'content_modified_at': file_modified_at,
271+
'content_modified_at': content_modified_at,
272272
}
273273
if additional_attributes:
274274
attributes.update(additional_attributes)
@@ -299,7 +299,7 @@ def update_contents(
299299
preflight_expected_size=0,
300300
upload_using_accelerator=False,
301301
file_name=None,
302-
file_modified_at=None,
302+
content_modified_at=None,
303303
additional_attributes=None,
304304
):
305305
"""Upload a new version of a file. The contents are taken from the given file path.
@@ -334,9 +334,9 @@ def update_contents(
334334
The new name to give the file on Box.
335335
:type file_name:
336336
`unicode` or None
337-
:param file_modified_at:
338-
The RFC-3339 datetime when the file was last modified.
339-
:type file_modified_at:
337+
:param content_modified_at:
338+
The RFC-3339 datetime when the file content was last modified.
339+
:type content_modified_at:
340340
`unicode` or None
341341
:param additional_attributes:
342342
A dictionary containing attributes to add to the file that are not covered by other parameters.
@@ -358,7 +358,7 @@ def update_contents(
358358
preflight_expected_size=preflight_expected_size,
359359
upload_using_accelerator=upload_using_accelerator,
360360
file_name=file_name,
361-
file_modified_at=file_modified_at,
361+
content_modified_at=content_modified_at,
362362
additional_attributes=additional_attributes,
363363
)
364364

boxsdk/object/folder.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ def upload_stream(
256256
preflight_check=False,
257257
preflight_expected_size=0,
258258
upload_using_accelerator=False,
259-
file_created_at=None,
260-
file_modified_at=None,
259+
content_created_at=None,
260+
content_modified_at=None,
261261
additional_attributes=None,
262262
):
263263
"""
@@ -294,13 +294,13 @@ def upload_stream(
294294
Please notice that this is a premium feature, which might not be available to your app.
295295
:type upload_using_accelerator:
296296
`bool`
297-
:param file_created_at:
297+
:param content_created_at:
298298
The RFC-3339 datetime when the file was created.
299-
:type file_created_at:
299+
:type content_created_at:
300300
`unicode` or None
301-
:param file_modified_at:
302-
The RFC-3339 datetime when the file was last modified.
303-
:type file_modified_at:
301+
:param content_modified_at:
302+
The RFC-3339 datetime when the file content was last modified.
303+
:type content_modified_at:
304304
`unicode` or None
305305
:param additional_attributes:
306306
A dictionary containing attributes to add to the file that are not covered by other parameters.
@@ -326,8 +326,8 @@ def upload_stream(
326326
'name': file_name,
327327
'parent': {'id': self._object_id},
328328
'description': file_description,
329-
'content_created_at': file_created_at,
330-
'content_modified_at': file_modified_at,
329+
'content_created_at': content_created_at,
330+
'content_modified_at': content_modified_at,
331331
}
332332
if additional_attributes:
333333
attributes.update(additional_attributes)
@@ -353,8 +353,8 @@ def upload(
353353
preflight_check=False,
354354
preflight_expected_size=0,
355355
upload_using_accelerator=False,
356-
file_created_at=None,
357-
file_modified_at=None,
356+
content_created_at=None,
357+
content_modified_at=None,
358358
additional_attributes=None,
359359
):
360360
"""
@@ -392,13 +392,13 @@ def upload(
392392
Please notice that this is a premium feature, which might not be available to your app.
393393
:type upload_using_accelerator:
394394
`bool`
395-
:param file_created_at:
395+
:param content_created_at:
396396
The RFC-3339 datetime when the file was created.
397-
:type file_created_at:
397+
:type content_created_at:
398398
`unicode` or None
399-
:param file_modified_at:
400-
The RFC-3339 datetime when the file was last modified.
401-
:type file_modified_at:
399+
:param content_modified_at:
400+
The RFC-3339 datetime when the file content was last modified.
401+
:type content_modified_at:
402402
`unicode` or None
403403
:param additional_attributes:
404404
A dictionary containing attributes to add to the file that are not covered by other parameters.
@@ -419,8 +419,8 @@ def upload(
419419
preflight_check,
420420
preflight_expected_size=preflight_expected_size,
421421
upload_using_accelerator=upload_using_accelerator,
422-
file_created_at=file_created_at,
423-
file_modified_at=file_modified_at,
422+
content_created_at=content_created_at,
423+
content_modified_at=content_modified_at,
424424
additional_attributes=additional_attributes,
425425
)
426426

test/unit/object/test_file.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def test_update_contents(
289289
):
290290
# pylint:disable=too-many-locals
291291
file_new_name = 'new_file_name'
292-
file_modified_at = '1970-01-01T11:11:11+11:11'
292+
content_modified_at = '1970-01-01T11:11:11+11:11'
293293
additional_attributes = {'attr': 123}
294294
expected_url = test_file.get_url('content').replace(API.BASE_API_URL, API.UPLOAD_URL)
295295
if upload_using_accelerator:
@@ -308,7 +308,7 @@ def test_update_contents(
308308
etag=etag,
309309
upload_using_accelerator=upload_using_accelerator,
310310
file_name=file_new_name,
311-
file_modified_at=file_modified_at,
311+
content_modified_at=content_modified_at,
312312
additional_attributes=additional_attributes,
313313
)
314314
else:
@@ -320,14 +320,14 @@ def test_update_contents(
320320
etag=etag,
321321
upload_using_accelerator=upload_using_accelerator,
322322
file_name=file_new_name,
323-
file_modified_at=file_modified_at,
323+
content_modified_at=content_modified_at,
324324
additional_attributes=additional_attributes,
325325
)
326326

327327
mock_files = {'file': ('unused', mock_file_stream)}
328328
attributes = {
329329
'name': file_new_name,
330-
'content_modified_at': file_modified_at,
330+
'content_modified_at': content_modified_at,
331331
}
332332
# Using `update` to mirror the actual impl, since the attributes could otherwise come through in a different order
333333
# in Python 2 tests

test/unit/object/test_folder.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ def test_upload(
225225
):
226226
# pylint:disable=too-many-locals
227227
file_description = 'Test File Description'
228-
file_created_at = '1970-01-01T00:00:00+00:00'
229-
file_modified_at = '1970-01-01T11:11:11+11:11'
228+
content_created_at = '1970-01-01T00:00:00+00:00'
229+
content_modified_at = '1970-01-01T11:11:11+11:11'
230230
additional_attributes = {'attr': 123}
231231
expected_url = '{0}/files/content'.format(API.UPLOAD_URL)
232232
if upload_using_accelerator:
@@ -245,8 +245,8 @@ def test_upload(
245245
basename(mock_file_path),
246246
file_description,
247247
upload_using_accelerator=upload_using_accelerator,
248-
file_created_at=file_created_at,
249-
file_modified_at=file_modified_at,
248+
content_created_at=content_created_at,
249+
content_modified_at=content_modified_at,
250250
additional_attributes=additional_attributes,
251251
)
252252
else:
@@ -257,8 +257,8 @@ def test_upload(
257257
mock_file_path,
258258
file_description=file_description,
259259
upload_using_accelerator=upload_using_accelerator,
260-
file_created_at=file_created_at,
261-
file_modified_at=file_modified_at,
260+
content_created_at=content_created_at,
261+
content_modified_at=content_modified_at,
262262
additional_attributes=additional_attributes,
263263
)
264264

@@ -267,8 +267,8 @@ def test_upload(
267267
'name': basename(mock_file_path),
268268
'parent': {'id': mock_object_id},
269269
'description': file_description,
270-
'content_created_at': file_created_at,
271-
'content_modified_at': file_modified_at,
270+
'content_created_at': content_created_at,
271+
'content_modified_at': content_modified_at,
272272
}
273273
# Using `update` to mirror the actual impl, since the attributes could otherwise come through in a different order
274274
# in Python 2 tests

0 commit comments

Comments
 (0)