here is an example of how I render data to forms

def preview_profile(self):
        if not session.has_key("logged_in"):
            return render('/index.tmpl')
        else:

            store = Store(database)
            c.username = session["username"]

            # USER PROFILE
====================================================

            userprofile = store.find(Profile,Profile.user_id ==
int(session["user_id"])).one()
            if userprofile is None:
                print " =========================="
                print ""
                print "profile does not exist"

                #response.headers['Cache-Control']='no-cache, no-
store, must-revalidate'
                return render('/my_profile.tmpl')
            else:

                c.firstname = userprofile.firstname
                c.lastname = userprofile.lastname
                c.title = userprofile.title
                c.profession = userprofile.profession
                c.homepage = userprofile.homepage
                c.street = userprofile.street
                c.city = userprofile.city


This is one of the forms that work, the "elephant" form does not
render, the only difference to the above is that its processing much
more data( saving data to several tables and then retrieving)




On Oct 3, 10:38 pm, voltron <[EMAIL PROTECTED]> wrote:
> This seems very weird to me, the more the reason why its so hard to
> describe, which labels me an idiot( is your harddrive formatted) of
> some sorts according to bruno. I´ll try to explain
>
> I receive data from several forms using FormEncode, save to a database
> and re-render the same form with the data I just saved
>
> data ->"myform.tmpl"  -> process data--> use s.variables to pass data
> onto my form template ---> "myform.tmpl"
>
> nothing special, always works
>
> in this case, I am captruring data  from a very large form, the
> controller form that takes care of this is over 50 lines long, I
> think, and when I try to use the same procedure as always( as above)
> it does not work
>
> Thats all, it would not make sense to post such a large piece of code
> here, because I do the ame thing with smaller forms and it works
>
> On Oct 3, 8:12 pm, "Jose Galvez" <[EMAIL PROTECTED]> wrote:
>
> > Aaaron,
> > This is such a simple and cool function! thanks for sharing it!
> > Jose
>
> > On 10/3/07, aaaron <[EMAIL PROTECTED]> wrote:
>
> > > I override render_response() (now called render() in pylons 0.9.6 i
> > > think) so any action can pass in default form values and htmlfill will
> > > populate the form accordingly. This way you don't need to rely on a
> > > form_result.
>
> > > in my_proj.lib.base.py:
>
> > > def render_response(*args, **kw):
>
> > >     form_defaults = kw.pop('form_defaults', False)
> > >     if form_defaults:
> > >         content = render(*args, **kw)
> > >         content = htmlfill.render(content, defaults=form_defaults)
> > >         return content
> > >     return render(*args, **kw)
>
> > > usage:
>
> > > h.render_response('/template', form_defaults=my_dict)
>
> > > -aaaron
>
> > > On Oct 1, 7:17 pm, voltron <[EMAIL PROTECTED]> wrote:
> > > > I have a form that I use to capture and display user data, I would
> > > > like the user to submit the form, a controller saves the data and re-
> > > > render the filled in data in the same form,  so I just redirect the
> > > > form to itself, strangely this does not work, is this the wrong way to
> > > > do this?
>
> > > > Thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to