Hi:
Have you tried to update properties via CMIS after a repo.query with python cmislib ?
I created a little script that searchs for two documents (kk.txt and kk3.txt) and tries to set / update a property on it.
It seems that someDoc.updateProperties(props) should work, where props are the proper dictionary for the properties. But I don't see what's wrong in the second case.
# This part works
docu = repo.getObjectByPath('/Test/kk.txt')
print docu
props = {'cmis:name': 'kk2.txt'}
docu.updateProperties(props)# This results in error
results = repo.query("SELECT * FROM cmis:document where cmis:name = 'kk3.txt' ")
someDoc = results[0]
print someDoc
props = {'cmis:name': 'kk4.txt'}
someDoc.updateProperties(props)
File "simple.py", line 35, in <module>
someDoc.updateProperties(props)
File "/usr/lib/python2.6/site-packages/cmislib_alfresco_extension-0.3.2-py2.6.egg/cmislibalf/extension.py", line 185, in updateProperties
selfUrl = self._getSelfLink()
File "/usr/lib/python2.6/site-packages/cmislib-0.5.1-py2.6.egg/cmislib/model.py", line 2169, in _getSelfLink
assert len(url) > 0, "Could not determine the self link."
TypeError: object of type 'NoneType' has no len()
I see no problems on permissions or allowable actions. Did I miss something ?
I use cmis 0.5.1 library with Alfresco 4.2.6 EE and CMIS 1.1 endpoint
Regards.
--C.
Solved! Go to Solution.
Hi Cesar,
then it MUST be the version problem, even if the document is not versioned. Try
someDoc=results[0].getLatestVersion()
Hope it works...
Wasn't there a bug in 0.5.1 with Alfresco cmis, returning less elements than expected on repo.query?
Tried iterating over result and accessing name as property of the element ( for result in results: print result.name )?
Maybe that helps...
Thanks Martin, it is quite strange. I didn't lose elements. Iterating over the result does not help... it seems that the objects resulting from repo.query is somehow different.
I walkarounded doing an extra repo.getObject query with the results of the repo.query
results = repo.query("SELECT * FROM cmis:document where cmis:name = 'kk3.txt' ")
#someDoc = results[0]someDoc = repo.getObject('workspace://SpacesStore/'+results[0].id)
print someDoc
pprint(someDoc)
props = {'cmis:name': 'kk4.txt'}
someDoc.updateProperties(props)
It is for 2M documents so I'll lose some time in the extra query
Regards.
--C.
Hi Cesar,
then it MUST be the version problem, even if the document is not versioned. Try
someDoc=results[0].getLatestVersion()
Hope it works...
It works like a charm Martin, thank you very much.
Best regards.
--C.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.