@@ -32,32 +32,6 @@ def _filter_check(property_filter, property_values):
32
32
def _append_targets (targets , container , prefix , total_size , total_cnt , optional , data_path , filters ):
33
33
for f in container .get ('files' , []):
34
34
if filters :
35
- # Here we use filters in the payload to exclude/include files.
36
- # To pass a single filter, each of its conditions should be satisfied.
37
- # If a file pass at least one filter, it is included in the targets.
38
- # For example:
39
- #
40
- # download_payload = {
41
- # 'optional': True,
42
- # 'nodes': [{'level':'project', '_id':project_id}],
43
- # 'filters':[{
44
- # 'tags':{'+':['incomplete']}
45
- # },
46
- # {
47
- # 'types':{'-':['dicom']}
48
- # }]
49
- # }
50
- # will download files with tag 'incomplete' OR type different from 'dicom'
51
- #
52
- # download_payload = {
53
- # 'optional': True,
54
- # 'nodes': [{'level':'project', '_id':project_id}],
55
- # 'filters':[{
56
- # 'tags':{'+':['incomplete']},
57
- # 'types':{'+':['dicom']}
58
- # }]
59
- # }
60
- # will download only files with tag 'incomplete' AND type different from 'dicom'
61
35
filtered = True
62
36
for filter_ in filters :
63
37
type_as_list = [f ['type' ]] if f .get ('type' ) else []
@@ -332,6 +306,34 @@ def _symlinkarchivestream(self, ticket, data_path):
332
306
333
307
334
308
def download (self ):
309
+ """
310
+ In downloads we use filters in the payload to exclude/include files.
311
+ To pass a single filter, each of its conditions should be satisfied.
312
+ If a file pass at least one filter, it is included in the targets.
313
+ For example:
314
+
315
+ download_payload = {
316
+ 'optional': True,
317
+ 'nodes': [{'level':'project', '_id':project_id}],
318
+ 'filters':[{
319
+ 'tags':{'+':['incomplete']}
320
+ },
321
+ {
322
+ 'types':{'-':['dicom']}
323
+ }]
324
+ }
325
+ will download files with tag 'incomplete' OR type different from 'dicom'
326
+
327
+ download_payload = {
328
+ 'optional': True,
329
+ 'nodes': [{'level':'project', '_id':project_id}],
330
+ 'filters':[{
331
+ 'tags':{'+':['incomplete']},
332
+ 'types':{'+':['dicom']}
333
+ }]
334
+ }
335
+ will download only files with tag 'incomplete' AND type different from 'dicom'
336
+ """
335
337
ticket_id = self .get_param ('ticket' )
336
338
if ticket_id :
337
339
ticket = config .db .downloads .find_one ({'_id' : ticket_id })
0 commit comments