[Plone-IT] Plone & mechanize (REPOST)

luigi scarso luigi.scarso a gmail.com
Ven 23 Gen 2009 13:10:17 UTC


>
>
> Si, ovviamente a te manca la request, CreateObject & C. invece accettano un
> input diretto molto pių facilmente.
>

cfr makerequest.makerequest
http://www.zope.org/Documentation/Books/ZDG/current/TestingAndDebugging.stx
x la request

Altro passetto...

##
## test.py
##
import AccessControl.SecurityManagement
from pprint import pprint as pprint
from Products.CMFPlone.utils import _createObjectByType
from Testing import makerequest
##
## zope site is app
##
##
appr = makerequest.makerequest(app)
admin = appr.acl_users.getUser('f')
AccessControl.SecurityManagement.newSecurityManager(None,admin)
pprint( "BEFORE" )
pprint( appr.Plone.Members.testuser.items() )
folder = appr.Plone.Members.testuser.invokeFactory("Folder", id="sample02",
title="sample02")
pprint( "AFTER" )
pprint( appr.Plone.Members.testuser.items() )


$>$PLONEROOT/Plone-3.1.7/zeocluster/parts/client2/bin/zopectl run test.py

BEFORE'
[('sample01', <ATFolder at /Plone/Members/testuser/sample01>)]
'AFTER'
[('sample01', <ATFolder at /Plone/Members/testuser/sample01>),
 ('sample02', <ATFolder at /Plone/Members/testuser/sample02>)]

sample01 l'ho creata col browser firefox, ed appare ;
sample02 *non* appare via web....



-- 
luigi
-------------- parte successiva --------------
Un allegato HTML č stato rimosso...
URL: <http://lists.plone.org/pipermail/plone-plone-it/attachments/20090123/49b5bfd5/attachment.html>


Maggiori informazioni sulla lista Plone-IT