My never-ending aquisition problem (calling ZSQL from PythonScript)
I'm having severe problems calling a ZSQL query from a Script from a form. MyFolder create_article_sql(params) (ZSQLMethod) create (PythonScript) MySubFolder get_article_form (DTMLMethod) In "create_article_sql" I create a record then select that record to return. In "get_article_form" I have <form action="create" ... etc (This should resolve to "/MyFolder/MySubFolder/create" shouldn't it?) In "create" I have... results = context.create_article_sql(params) return results But all I ever get is a Not Found error. I don't get a Not Found error if in "create" I just return 1.... So the "create" script is not finding the "create_article_sql" ZSQL Method, even though it is in the same folder (though being called from a sub-folder) Can anyone help please? ta tom -- tom smith | tom@othermedia.com http://www.othermedia.com/blog 3rd Floor, The Pavilion, Newhams Row, London, SE1 3UZ 0207 089 5959
I think I may have sorted this out again (but it somehow doesn't seem right) If you call a ZSQLMethod from a PythonScript and then use the results as an object, rather than iterating through that object, you get funny Not Found errors. For example... results = context.do_some_sql(some_params) return results ...will not return a list of <db results> objects (which I think it should). but this will work fine... results = context.do_some_sql(some_params) result_list - [ ] for i in results: result_list.append(i) # result_list.append(i.id) #result_list.append(i.some_other_attribute) return result_list ...why is this? It keeps catching me out.
participants (1)
-
Tom Smith