[albatross-users] newbie (coming from java) question
Didrik Pinte
pinted at tiscali.be
Thu Jun 3 16:48:40 EST 2004
Le mer 02/06/2004 à 11:40, Didrik Pinte a écrit :
> class ListPage:
> '''This page shows the list of results due to the search
> '''
>
> name = 'list'
>
> def page_enter(self, ctx):
> ctx.locals.doclist = []
> ctx.add_session_vars('doclist')
>
> def page_process(self,ctx):
> if ctx.req_equals('detail'):
> ctx.set_page('detail')
> elif ctx.req_equals('recherche'):
> container = getContainer()
> for result in
> container.searchContains('title',ctx.locals.title):
> ctx.locals.doclist.append(result)
> if len(ctx.locals.doclist)<1 :
> ctx.locals.error = "No document found"
> ctx.set_page('error')
> else :
> ctx.add_session_vars('doclist')
>
> def page_display(self,ctx):
> ctx.load_template('headers.html').to_html(ctx)
> ctx.load_template('footer.html').to_html(ctx)
> ctx.run_template('list.html')
Ok, i've added some debug to the page. I'm just printing out the name of
the method called.
It seems that it never goes in the page_process() method ...
The workflow is this :
1) SearchPage : a form where the user enters a title, then submit de the
from. Here is the class :
class SearchPage:
''' This is the first page of the application. It contains a form
with some fields that will be used to search the metadata
'''
name = 'search'
def page_enter(self, ctx):
#Initialises the variables of the form to None
ctx.locals.title = ctx.locals.denomination =
ctx.locals.description = None
def page_process(self,ctx):
if ctx.req_equals('recherche'):
ctx.set_page('list')
def page_display(self,ctx):
ctx.run_template('search.html')
2) Using the submit input name (recherche), the user must be redirected
to the ListPage using the page_process() method of SearchPage, no ?
Didrik
More information about the Albatross-users
mailing list