[Zope] strange script behaviour

J Cameron Cooper jccooper at jcameroncooper.com
Tue Jan 27 15:25:59 EST 2004


Marie Robichon wrote:

>> Are you viewing it in a browser only? It's possible that the browser 
>> is seeing HTML-ish code and (properly) ignoring all the tags, as they 
>> mean nothing to it. Try a "view source" and see if it's really being 
>> rendered properly or not.
>>
>> Otherwise, maybe you ran afoul of Python escaping rules (though I 
>> don't see where.) Do some tests at the Python console to find out.
>
> Thanks a lot this was exactly the problem.
>
> Now I have another one ;-).  When I run my script (see below) the 
> 'manage_addZSQLMethod' raises an attribute error, but I can't see 
> why.  My arg string and my sql string are correct, my connection_id also.
> ...
> folder=getattr(context,'id')
>
> folder.manage_addZSQLMethod('insert'+tableName,'Insert into 
> '+tableName,'Oracle_database_connection',arg,sql)

The syntax for adding products is::

 context.manage_addProduct['Product'].manage_addProduct(id='new_id2', ...)

and see http://www.zopelabs.com/cookbook/1012279676

You must look up the module via 'manage_addProduct' in order to get the 
constructor. In your case::

 folder.manage_addProduct['ZSQLMethods'].manage_addZSQLMethod('insert'+tableName,'Insert 
into '+tableName,'Oracle_database_connection',arg,sql)

You may also be interested in 
http://zope.org/Members/karpati/books/create_files

          --jcc

-- 
"Code generators follow the 80/20 rule. They solve most of the problems, but not all of the problems. There are always features and edge cases that will need hand-coding. Even if code generation could build 100 percent of the application, there will still be an endless supply of boring meetings about feature design."
(http://www.devx.com/java/editorial/15511)





More information about the Zope mailing list