[Zope] Newbie: creating objects programmatically

Dmitry Dembinsky dmitry@deluxoft.com
Wed, 14 May 2003 15:11:21 +0200


> >1) method document_src() requires no parameters  (self is passed 
> >implicitly
> by python)
> >so you write
> >context.['index_html'].write(context.memberIndex.document_src())
> 
> I tried this and got the error message mentioned, so I tried 
> again with the 
> explicit 'self' - no go.
> 
> >2) To create a page template with a content, you may pass it in 
> >constructor: 
> >container.manage_addProduct['PageTemplates'],manage_addPageTe
> mplaate('index_html',
> text=context.memberIndex.document_src())
> 
> This is certainly more elegant and I had spotted it in 
> ZopePageTemplates.py 
> but I wanted to go step by step. 
> 
> However, neither of the solutions works for me because I 
> always get the 
> 'Unauthorized' error message.  With my limited experience, I 
> don't know how 
> to start debugging this.  Can you help me again?
> 

I tried the solution on my WinXP+Zope 2.6.1 server and it works fine.
What environment do you use? OS? Zope server version? Browser?

How do you test it? 
Do you select "Test" tab in the ZMI or you open a new window and type
URL ?
There is a difference in browser behavior e.g. for Mozilla, no matter
how many browser windows you open, 
you're still logged as the same zope user (Manager in your case)
This doesn't always applies to IE.

document_src() method requires 'View management screens' permission and
if you open a new instance of IE,
You're effectively an 'Anonymous User' which doesn't have it.

If it is not the case, you may to use VerboseSecurity product

http://hathaway.freezope.org/Software/VerboseSecurity

to determine what persmission is missing

Regards,
Dmitry