Plone+Python - 如何自动将内容项设置为文件夹的默认视图?

发布于 2024-12-13 18:29:44 字数 737 浏览 2 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

霊感 2024-12-20 18:29:44

您要查找的方法是文件夹中的 setDefaultPage。如果您有权通过 Web 与您的用户设置默认页面,那么您也通过 XML-RPC 拥有相同的权利,访问控制与方法无关。 setDefaultPage 将页面对象的 id 作为参数。

setDefaultPageISelectableBrowserDefault 接口,查看该接口以了解更多详细信息。

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 the ISelectableBrowserDefault interface, take a look at that for more details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文