用于python的alfresco rest web服务客户端库
alfREST的Python项目详细描述
一个基于alfresco restful web服务的ligthweight python库。
示例用法:
from alfREST import RESTHelper path = "/Sites/mysite/documentLibrary/test" # login rh = RESTHelper() rh.login(login, password, host, port) # createDocument (sio could be a file object...) from StringIO import StringIO sio = StringIO() sio.write("Well, that's all folks.") sio.seek(0) sio.name = "test.txt" tkns = path.split("/") siteId = tkns[2] containerId = tkns[3] uploadDirectory = "/".join(tkns[4:]) idObject = rh.fileUpload(sio, siteId, containerId, "/%s" % uploadDirectory) sio.close() # get properties props = rh.getProperties("%s/test.txt" % path) assert props["cmis:createdBy"] == login # get content content = rh.getContent("%s/test.txt" % path) assert content == "Well, that's all folks." # add a tag to the document rh.addTag("workspace", "SpacesStore", idObject, "tag_test") assert "tag_test" in rh.getNodeTags("workspace", "SpacesStore", idObject) # list document in folder children = rh.getChildren(path) assert children[0]["cmis:name"] == "test.txt" # create a group and apply a policy to the test folder rh.addRootGroup(u"GROUP_TEST") acl = {} acl[u'GROUP_TEST'] = [([u"{http://www.alfresco.org/model/content/1.0}cmobject.Consumer",], True),] rh.applyACL(path, acl) # create a new user, insert the user in the group rh.addPerson("supermario", "mario", "super", "supermario@nintendo.com", "imsuper") rh.addGroupOrUserToGroup(u"supermario", u"GROUP_TEST") # some check users = rh.listChildAuthorities(u"GROUP_TEST") assert len(users) == 1 assert users[0]['fullName'] == "supermario" # restore initial status rh.removeAuthorityFromGroup(u"supermario", u"GROUP_TEST") rh.deletePerson("supermario") acl = {} rh.applyACL(path, acl) rh.deleteRootGroup(u"GROUP_TEST") # remove tag from the file object rh.deleteTag("workspace", "SpacesStore", idObject, "tag_test") assert "tag_test" not in rh.getNodeTags("workspace", "SpacesStore", idObject) # delete the file object rh.deleteObject(idObject) # logout rh.logout()
changelogs 0.9.3
- 添加标签
- 删除标记
changelogs 0.9.2c(错误修复:上传二进制文件有效)
- 创建文件夹
- get node tags(获取节点的所有标记)
changelogs 0.9.1
- 上载(将文件内容和元数据上载到存储库)
- 删除文件(删除指定对象)
- getchildren(获取指定文件夹中包含的子对象列表)
- getcontent(获取指定文档的内容流)
- getproperties(获取对象的属性)
road到1.0
- 创建/移动文件夹或文档(create document、create folder、createpolicy、moveobject)
- 写入内容(setcontent)
- 删除内容(deleteContent)
- 获取内容(get content)
- 获取文件夹子项(get children)
road到1.1
- 获取签出文档(getcheckedoutdocs)
- 签出文档(签出)
- 取消签出(取消签出)
- 签入私人工作副本(签入)
联系人
更多信息和请求:TiigiaN[AtasaTudio.IT/<