[Zope-CMF] Workflow - Publish All Objects in Folder
Roel Van den Bergh
roel@planetinterior.com
Wed, 3 Apr 2002 10:14:23 +0200
Unfortunately your solution didn't work
I changed the script to:
#create (Python) Script called, publish_all
wf_tool=context.portal_workflow
print 'go go auto-publish'
for o in context.contentValues():
if hasattr(o,"isPortalContent"):
try:
wf_tool.doActionFor(o, 'publish')
except:
print o.objectId() + ' didnt publish '
return printed
I tried it first in a folder containing folders containting folders
containing ... containing items
I test it and I see 'go go autopublish' but no state is changed
When I test it in a folder containing only files to be published (uploaded
trough FTP) I get
Error Type: AttributeError
Error Value: objectId
----
Troubleshooting Suggestions
The URL may be incorrect.
The parameters passed to this resource may be incorrect.
A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the HTML
source for this page.
If the error persists please contact the site maintainer. Thank you for your
patience.
Traceback (innermost last):
File C:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line 150, in
publish_module
File C:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line 114, in
publish
File C:\Program Files\Zope\lib\python\Zope\__init__.py, line 158, in
zpublisher_exception_hook
(Object: Drawings)
File C:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line 98, in
publish
File C:\Program Files\Zope\lib\python\ZPublisher\mapply.py, line 88, in
mapply
(Object: publish_all)
File C:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line 39, in
call_object
(Object: publish_all)
File C:\Program Files\Zope\lib\python\Shared\DC\Scripts\Bindings.py, line
252, in __call__
(Object: publish_all)
File C:\Program Files\Zope\lib\python\Shared\DC\Scripts\Bindings.py, line
283, in _bindAndExec
(Object: publish_all)
File C:\Program
Files\Zope\lib\python\Products\PythonScripts\PythonScript.py, line 291, in
_exec
(Object: publish_all)
(Info: ({'script': <PythonScript instance at 01BAA2F8>, 'context':
<PortalFolder instance at 01FC5598>, 'container': <PortalFolder instance at
01FC5598>, 'traverse_subpath': []}, (), {}, None))
File Script (Python), line 10, in publish_all
File C:\Program Files\Zope\lib\python\AccessControl\ZopeGuards.py, line
47, in guarded_getattr
(Object: 021684_410_inp_01_bg.dwg)
AttributeError: (see above)
-----Oorspronkelijk bericht-----
Van: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]Namens Jo
Meder
Verzonden: woensdag 3 april 2002 9:38
Aan: zope-cmf@zope.org
Onderwerp: Re: [Zope-CMF] Workflow - Publish All Objects in Folder
Am 03.04.2002, 09:28 Uhr
schrub Roel Van den Bergh <roel@planetinterior.com>:
> After running the following script under winZope 2.5.0 and CMF 1.2 with
CMF
> Workflow Revision 2 (Submitted by: runyaga & Last Edited: 2002-02-27,
found
> on ZopeLabs)
>
> #create (Python) Script called, publish_all
> wf_tool=context.portal_workflow
>
> print 'go go auto-publish'
> for o in context.contentValues():
> try:
> wf_tool.doActionFor(o, 'publish')
> except:
> print o.objectId() + ' didnt publish '
>
> return printed
>
> I get the following error:
>
> Error Type: AttributeError
> Error Value: objectId
You could try to limit your actions
if hasattr(o,"isPortalContent"):
to objects for which publishing is relevant. I don't know if this solves
your problem but since this is in my "publish_all"-code and I've never
run into the problem you describe, why not give it a try.
Jo.