Skip to content

Commit f168622

Browse files
committed
remove unwanted md
1 parent 833748d commit f168622

2 files changed

Lines changed: 29 additions & 8 deletions

File tree

mkdocs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ nav:
4545
# - Team: tutorials/python/team.md
4646
- Upload data in bulk: tutorials/python/upload_data_in_bulk.md
4747
- Download data in bulk: tutorials/python/download_data_in_bulk.md
48-
- Manifest Operations: tutorials/python/manifest_operations.md
49-
- Creating JSON Schema: tutorials/python/schema_operations.md
5048
# - Creating JSON Schema: tutorials/python/schema_operations.md
5149
- Working with JSON Schema: tutorials/python/json_schema.md
5250
- Storage Location: tutorials/python/storage_location.md

synapseclient/models/mixins/storage_location_mixin.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,17 @@ async def set_storage_location_async(
279279
) -> "ProjectSetting":
280280
"""Set the upload storage location for this entity. This configures where
281281
files uploaded to this entity will be stored.
282-
By default, the default storage location is used.
283-
If the storage location is not provided, the default storage location is used.
282+
283+
**This is a destructive update.** The provided `storage_location_id` value(s)
284+
will **replace** any storage locations previously configured on this entity.
285+
To add a storage location without removing existing ones, first retrieve the
286+
current setting via `get_project_setting_async`, append to its `locations`
287+
list, and call `store_async` on the returned `ProjectSetting` directly.
284288
285289
Arguments:
286290
storage_location_id: The storage location ID(s) to set. Can be a single
287-
ID, a list of IDs (first is default, max 10), or None to use
288-
Synapse default storage. By default, the default Synapse S3 storage location is used.
291+
ID, a list of IDs (first is default, max 10). By default, the
292+
default Synapse S3 storage location is used.
289293
synapse_client: If not passed in and caching was not disabled by
290294
`Synapse.allow_client_caching(False)` this will use the last created
291295
instance from the Synapse class constructor.
@@ -296,8 +300,8 @@ async def set_storage_location_async(
296300
Raises:
297301
ValueError: If the entity does not have an id set.
298302
299-
Example: Using this function
300-
Set storage location on a folder:
303+
Example: Replace all storage locations
304+
Fully replace the storage location on a folder with a single location:
301305
302306
import asyncio
303307
from synapseclient import Synapse
@@ -314,6 +318,25 @@ async def main():
314318
print(setting)
315319
316320
asyncio.run(main())
321+
322+
Example: Partial update — add a storage location without removing existing ones
323+
Retrieve the current setting and append a new location:
324+
325+
import asyncio
326+
from synapseclient import Synapse
327+
from synapseclient.models import Folder
328+
329+
syn = Synapse()
330+
syn.login()
331+
332+
async def main():
333+
folder = await Folder(id="syn123").get_async()
334+
setting = await folder.get_project_setting_async(setting_type="upload")
335+
if setting:
336+
setting.locations.append(67890)
337+
await setting.store_async()
338+
339+
asyncio.run(main())
317340
"""
318341
from synapseclient.models.project_setting import ProjectSetting
319342

0 commit comments

Comments
 (0)