Select to view content in your preferred language

Two issues of Cell [22] in Clone Portal sample notebook

1941
4
Jump to solution
01-13-2017 01:06 PM
XuehanJing
Occasional Contributor

Hello,

I seems find another two issue in Cell [22] in Clone Portal sample notebook. clone portal users groups and content | ArcGIS for Developers 

Below is the screen shot of code that may have issue.

Code

Issue 1: In this line,

target.content.create_folder(user, folder)

I checked API of create_folder() method, it writes

create_folder(folder, owner=None), we have folder first, then the owner

But in the sample notebook code, the order is opposite.

Shouldn't we use, target.content.create_folder(folder, user) instead?

Issue 2:

I got another error when I access the folder title using folder.title. It returns following error message. For testing I create a test script.

The folder does have the key title, but for some reason we can't access it using folder.title in API. It causes problem in this sample notebook, since it uses folder.title to access the folder title.

Thanks

0 Kudos
1 Solution

Accepted Solutions
RohitSingh2
Esri Contributor

Hello,

I believe you've found more bugs in this sample. 

1) It should be 

target.content.create_folder(folder, user)

2) folder is a dict and not an object with a title property - so you'd need to replace folder.title with folder['title']

We'll be fixing these in the sample - thanks for reporting the issues.

Thanks,

Rohit

View solution in original post

0 Kudos
4 Replies
RohitSingh2
Esri Contributor

Hello,

I believe you've found more bugs in this sample. 

1) It should be 

target.content.create_folder(folder, user)

2) folder is a dict and not an object with a title property - so you'd need to replace folder.title with folder['title']

We'll be fixing these in the sample - thanks for reporting the issues.

Thanks,

Rohit

0 Kudos
XuehanJing
Occasional Contributor

Thanks for clarification.

0 Kudos
XuehanJing
Occasional Contributor

Hi Rohit,

I found one more issue in cell [22] in this sample notebook.

It is at #Copy the related items for this user (if specified)

Code2

For this line,

folderitems = usercontent[folder], I got error, because usercontent here is a list.

I think we should use folderitems = user.items(folder['title']) instead.

Looking forward to your comment on this.

Thanks.

0 Kudos
RohitSingh2
Esri Contributor

Hi Xuehan,

Thanks for reporting this as well. Your fix is correct. We will be including this fix in the update to the sample within the next week, as part of the 1.0.1 update to the API.

Thanks,

Rohit