Re: newbie (coming from java) question
Gregory Bond <[email protected]> Wed, 02 Jun 2004 10:32:06 +1000
| Newsgroups | gmane.comp.web.albatross.general |
|---|---|
| Message-ID | <[email protected]> |
A couple of things spring to mind. [email protected] said: > if ctx.req_equals('detail'): > ctx.set_page('detail') > if ctx.req_equals('recherche'): this should usually be elif - the set_page() call doesn't terminate the page_process function (tho depending on the html template, you may never hit the case where detail and recherche are both true...) > docInfoList = [] > for result in container.searchContains('title',ctx.locals.title): > docInfoList.append(result) Any particular reason this is not written as docInfoList = container.searchContains(....) (this is a general python nit not an albatross nit!) Are you expecting the ctx.metaData to be in the session? The code as written will have a single metadata object that is recreated each time an HTTP request is made (assuming this is a CGI and not, say, a mod_python script....) so any changes made to the metaData object by the searchContents() function will be lost. [email protected] said: > My code does not work (what a shame !) Apart from the above, it looks reasonable enough to me. To go further, we'd need a fair bit more info. What "does not work'? Does it throw exceptions? What's broken?