Skip to content

Commit 12109f9

Browse files
committed
correct RFEADME again
1 parent e565b16 commit 12109f9

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,29 +2139,35 @@ session.acls.apply_atomic_operations(
21392139
```
21402140
`ACLOperation` objects form a linear order with `iRODSAccess` objects, and
21412141
indeed are subclassed from them as well, allowing intermixed sequences to be
2142-
sorted; however, care should be taken to normalize the objects before comparisons
2143-
or for related uses of the 'in' operator:
2142+
sorted. Care should be taken to normalize the objects before such comparisons,
2143+
sorting, or with related uses of the 'in' operator:
21442144
```py
2145+
from irods.access import *
21452146
normalize = lambda acl: acl.copy(decanonicalize=-1, implied_zone='tempZone')
21462147
acls = sorted(
21472148
[
2148-
iRODSAccess('read object', '/tempZone/home/alice', 'bob', 'tempZone'),
2149+
iRODSAccess('read_object', '/tempZone/home/alice', 'bob', 'tempZone'),
21492150
ACLOperation('write', 'rods'),
21502151
ACLOperation('read', 'bob'),
21512152
],
21522153
key=normalize
21532154
)
21542155
print(normalize(acls[0]) == normalize(acls[1]))
2156+
print(normalize(iRODSAccess('read', '/tempZone/home/alice', 'bob')) in map(normalize, acls))
21552157
```
21562158

2157-
perms = sorted(
2159+
If strict order of permissions is desired, use something like the below:
2160+
```py
2161+
from irods.access import *
2162+
from pprint import pp
2163+
pp(sorted(
21582164
[
21592165
ACLOperation('read', 'bob'),
2160-
ACLOperation('write', 'rods'),
2166+
ACLOperation('own', 'rods'),
21612167
ACLOperation('read_object', 'alice')
21622168
],
2163-
key=lambda acl: iRODSAccess.codes[acl.access_name]
2164-
)
2169+
key=lambda acl: (all_permissions[acl.access_name], normalize(acl))
2170+
))
21652171
```
21662172

21672173
Quotas (v2.0.0)

0 commit comments

Comments
 (0)