[Zope] Current Folder

Jonathan Hobbs toolkit at magma.ca
Mon Sep 20 17:01:03 EDT 2004


Please keep your posts on the list...

I am not familiar with 'invokeFactory', but I have used
manage_addDTMLDocument (and DTMLMethod) with no problems.

When in doubt... try it!

Jonathan



----- Original Message -----
From: "Greg Gehrich" <greggehrich at yahoo.com>
To: "Jonathan Hobbs" <toolkit at magma.ca>
Sent: September 20, 2004 4:49 PM
Subject: Re: [Zope] Current Folder


> Jonathon,
>
> Here's my code.  I'm still getting an attribute error when calling
capture_html_extmethod.  Should
> I be using manage_addDTMLDocument instead of invokeFactory?
>
> Thanks, Gregory
>
> <code>
>     #assign the page to be captured to a variable
>     capture_page_name = remote_url
>
>     # Create new document
>     context.invokeFactory(id='test123.html', type_name='Document',
description='test stuff')
>     newdoc = context.restrictedTraverse('test123.html')
>
>     # Populate a variable with captured HTML returned from the external
method
>     htmlPageData =
newdoc.capture_html_extmethod(page_url=capture_page_name)
>
>     # Add data to created page
>     newdoc.edit('html',htmlPageData)
>     return "Created test123.html document!"
> </code>
>
> --- Jonathan Hobbs <toolkit at magma.ca> wrote:
>
> > ----- Original Message -----
> > From: "Gregory Gehrich" <greggehrich at yahoo.com>
> > > I want to use a Python script within Zope to create a document.  If I
> > > have a folder that I want to create it in--no problem, I use getattr
and
> > > use the name of the folder.
> > >
> > > The problem occurs if I want to use the current directory instead.
What
> > > is need is to use something like getattr with the current directory
name.
> >
> >
> > This should work:
> >
> > #create a DTML Document in the same folder as this python script is
running
> > in
> > context.manage_addDTMLDocument('newDoc', 'newTitle')
> >
> > #get the new object
> > ndoc=context.restrictedTraverse('newDoc')
> >
> > #stick some text into the document
> > docContents='Some text'
> > ndoc.manage_edit(docContents, 'aNewTitle')
> >
> > return 'All Done'
> >
> >
> > HTH
> >
> > Jonathan
> >
> >
> >
>
>
>
>
>
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com




More information about the Zope mailing list