At 16:42 2003-04-15 +0200, Marie Robichon said:
At 14:15 15/04/2003 +0000, you wrote:
At 15:45 2003-04-15 +0200, Marie Robichon said:
Hi,
I want to add an object via a python script, but cannot find the syntax to reference the destination folder which is in the 'Intranet' virtual root of my site The following doesn't work and I've tried various other ways, and haven't found a faq or solution anywhere. Probably something dumb again.....
newsfolder=News.FrontNews
newsfolder.manage_addProduct['EasyEditor'].addEasyNewsItem( note_id, note_title...............
Hi Marie, I think you might be missing 'context'?
newsfolder=context.News.FrontNews
no using newsfolder=context.News.FrontNews gives me an AttributeError. The script is in fact in Intranet/Test/Marie/Notes and I want to add an EasyNewsItem to Intranet/News/FrontNews (Intranet being our virtual root) so I don't think I should be using context?
I don't know why you get an AttributeError, it's hard for me to tell. You could use container as a starting point if you like, it would work equal in your scenario. Actually what happens in your code is that the context is changed to point to News/FrontNews in dependent if you use container or context. News is actually acquired from what ever starting point you use. (Acquisition is a marvelous and confusing beast :-) You could also use (if you like to point to the FrontNews object with an URL) news=context.restrictedTraverse('/Intranet/News/FrontNews') # If the physical URL is /Intranet/News/FrontNews news.manage_addProduct['EasyEditor'].addEasyNewsItem(<id and stuff>) Best Regards, Johan Carlsson Easy Publisher Developers Team Johan Carlsson johanc@easypublisher.com Mail: Birkagatan 9 SE-113 36 Stockholm Sweden Phone +46-(0)8-31 24 94 Fax +46-(0)8-673 04 44 Mobil +46-(0)70-558 25 24 http://www.easypublisher.com