Hi

I try to input some data (add_module), but 1 Parameter should be
selected before which is needed for selecting the correct form. Now I
did this with to classes:

calling class moduletype_select() first and this one then this one
call the correct class add_module() with the information from
moduletype_select().

Is there a better / easier way to have let's say one or two line of
code in add_module() where I can direct call this class without the
need of having/calling to classes?

I'm very new to web.py and also a python beginner, so it would be nice
if somebody can help me with better code for this problem.


class moduletype_select:
    def GET(self):
        form = select_form
        return render.new(form,  'moduletype')
    def POST(self):
        form = select_form
        if not form.validates():
            return render.new(form, 'moduletype' )
        moduletype = int(form.d.moduletype)
        raise web.seeother('/config/module/add/%s' % (moduletype))


class add_module:
   def GET(self,  moduletype):
        form = module_form(moduletype)
        return render.new(form,  'module')
    def POST(self,  moduletype):
        form = module_form(moduletype)
        if not form.validates():
                return render.new(form,  'module')
    model.add_data('module',  moduletype=moduletype,  **form.d)
    raise web.seeother('/config/module/list')

Kind regards,
Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to