Skip to content

Commit 4315b8d

Browse files
d-w-moorealanking
authored andcommitted
[#710] import make_session from irods.helpers in examples
Previously it was imported from irods.test.helpers, and when called would (by design) raise an exception if the iRODS server's version is higher than the given client's advertised compatibility level as defined by irods.message.IRODS_VERSION
1 parent b136efb commit 4315b8d

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ In a small but illustrative example, the following Python session does
459459
not require an explicit call to `f.close()`:
460460

461461
```python
462-
>>> import irods.client_configuration as config, irods.test.helpers as helpers
462+
>>> import irods.client_configuration as config, irods.helpers as helpers
463463
>>> config.data_objects.auto_close = True
464464
>>> session = helpers.make_session()
465465
>>> f = session.data_objects.open('/{0.zone}/home/{0.username}/new_object.txt'.format(session),'w')
@@ -850,7 +850,7 @@ the backquote character, have historically presented problems
850850
Consider this small, contrived application:
851851

852852
```python
853-
from irods.test.helpers import make_session
853+
from irods.helpers import make_session
854854

855855
def create_notes( session, obj_name, content = u'' ):
856856
get_home_coll = lambda ses: "/{0.zone}/home/{0.username}".format(ses)
@@ -864,13 +864,14 @@ Consider this small, contrived application:
864864

865865
# Example 1 : exception thrown when name has non-printable character
866866
try:
867-
create_notes( session, "lucky\033.dat", content = u'test' )
867+
create_notes( session, "lucky\1.dat", content = u'test' )
868868
except:
869869
pass
870870

871871
# Example 2 (Ref. issue: irods/irods #4132, fixed for 4.2.9 release of iRODS)
872872
print(
873-
create_notes( session, "Alice's diary").name # note diff (' != ') in printed name
873+
create_notes(session, "Alice`s diary").name # The difference in the printed name is subtle, as
874+
# "`" is transformed to "'" in iRODS pre-4.2.9
874875
)
875876
```
876877

@@ -1941,12 +1942,13 @@ $ dd if=/dev/urandom of=largefile count=40k bs=1k # create 40-megabyte test file
19411942

19421943
$ pip install 'python-irodsclient>=1.1.2'
19431944

1944-
$ python -c"from irods.test.helpers import make_session
1945-
import irods.keywords as kw
1946-
with make_session() as sess:
1947-
sess.data_objects.put( 'largefile',
1948-
'/tempZone/home/rods/largeFile1',
1949-
**{kw.DEST_RESC_NAME_KW:'s3resc'} )
1950-
sess.data_objects.get( '/tempZone/home/rods/largeFile1',
1951-
'/tmp/largefile')
1945+
$ python -c"\
1946+
from irods.helpers import make_session
1947+
import irods.keywords as kw
1948+
with make_session() as sess:
1949+
sess.data_objects.put( 'largefile',
1950+
'/tempZone/home/rods/largeFile1',
1951+
**{kw.DEST_RESC_NAME_KW:'s3resc'} )
1952+
sess.data_objects.get( '/tempZone/home/rods/largeFile1',
1953+
'/tmp/largefile')"
19521954
```

0 commit comments

Comments
 (0)