Plone+Python - 如何自动将内容项设置为文件夹的默认视图?
我使用 xmlrpclib、wsapi4plone 将内容上传到 plone。 假设我要创建一个文件夹:
client = xmlrpclib.ServerProxy('http://user:[email protected]/plone')
f = {'blah.com/plone/folder':
[
{'title': folder},
'Folder', None,
]
}
print 'Creating...', client.post_object(f)
然后在该文件夹中上传一个页面:
page = {'blah.com/plone/filename':
[
{'title':filename, 'text':file.read()},
'Document',None,
]
}
client.post_object(page)
如何通过 python 设置文件夹以使用此页面作为其默认视图?
另外,我不是管理员,只是一个普通用户,所以你知道..
你能帮忙吗?谢谢
I use xmlrpclib, wsapi4plone to upload stuff to plone.
Say I'm going to create a folder:
client = xmlrpclib.ServerProxy('http://user:[email protected]/plone')
f = {'blah.com/plone/folder':
[
{'title': folder},
'Folder', None,
]
}
print 'Creating...', client.post_object(f)
then upload a page in that folder:
page = {'blah.com/plone/filename':
[
{'title':filename, 'text':file.read()},
'Document',None,
]
}
client.post_object(page)
How do I set the folder to use this page for its default view through python?
Also, I am not the admin, just a normal user just so you know..
Could you please help? Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要查找的方法是文件夹中的
setDefaultPage
。如果您有权通过 Web 与您的用户设置默认页面,那么您也通过 XML-RPC 拥有相同的权利,访问控制与方法无关。setDefaultPage
将页面对象的 id 作为参数。setDefaultPage
是ISelectableBrowserDefault
接口,查看该接口以了解更多详细信息。The method you are looking for is
setDefaultPage
on the folder. If you have the right to set the default page through the web with your user, you have the same right via XML-RPC, access control is method agnostic.setDefaultPage
takes the id of the page object as an argument.setDefaultPage
is part of theISelectableBrowserDefault
interface, take a look at that for more details.