[Zope] strange script behaviour

Marie Robichon robichon at esrf.fr
Tue Jan 27 04:55:52 EST 2004


>
>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.
Hi,

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.

Any ideas ?

TIA

Marie




## Script (Python) "insertSQL"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=tableName
##title=
##
arg=""
for field in context.Formulator.get_fields():
    if field.meta_type!='LabelField':
        arg= arg+ field.id + "\n"

sql="insert into "+ tableName + "\n "
sql=sql+"("

for field in context.Formulator.get_fields():
    if field.meta_type!='LabelField':
       sql= sql+ field.id + ", \n"

sql=sql[:-3]
sql=sql+") \n values \n("


for field in context.Formulator.get_fields():
    if field.meta_type!='LabelField':
       if field.meta_type=='IntegerField':
          type='int'
       else:
          type='string'
       if field.is_required():
          constraint=""
       else:
          constraint="optional"
       if field.meta_type=='MultiCheckBoxField':
          sql=sql+"<dtml-in " + field.id + ">\n"
          sql=sql+"<dtml-var sequence-item>;"
          sql = sql + "< /dtml-in>,\n"
       else:
          sql=sql + "<dtml-sqlvar "+ field.id + " type="+type + " " + 
constraint + ">, \n"
sql=sql[:-4]
sql=sql+">)"


folder=getattr(context,'id')

folder.manage_addZSQLMethod('insert'+tableName,'Insert into 
'+tableName,'Oracle_database_connection',arg,sql)




More information about the Zope mailing list