Thanks. I guess that answers my question, though I was really trying
to keep the code DRY, which is why I wanted to only call it once, as
these dropdowns are on each page of the application. It looks like an
AJAX call might be a more elegant solution in this case. Thanks for
your help!

Also, I'm sorry I never responded with my code; it looks like you
posted that while I was typing me addendum; never saw it until this
morning!

-Tom

On Dec 6, 5:36 pm, Justin Davis <jedavi...@gmail.com> wrote:
> It sounds to me like you're trying to use webpy as if it were CGI.
> Webpy running through fastcgi is a persistent process that doesn't get
> fired off again upon the next request. Therefore, any insertion into
> the database will have to update any datastructures in memory -- they
> will not be re-initialized automatically. Something like this perhaps:
>
> class choices:
>   def GET(self):
>     choices = db.select('foo')
>     return render.page(choices)
>
>   def POST(self):
>     db.insert('foo', myvalue=web.input().myvalue)
>     raise web.seeother('/choices')
>
> On Dec 6, 2:13 pm, Tom <tom.thorog...@gmail.com> wrote:
>
>
>
>
>
>
>
> > After further testing, I have determined that the issue is the way the
> > dropdown menus are rendered.
>
> > I have passed a global module to the templates called "bits" which is
> > where I store misc. HTML; it is this module that is querying the
> > databse and parsing the information as a dropdown. So when I call
> > $:bits.search_menu, it populates the template with the dropdown menus.
>
> > The problem, then, I think is how web.py is calling "bits". I've pored
> > through the web.py source code looking for this, and I can't find an
> > answer. I've enabled autoreload, but it's not helping.
>
> > As a workaround, I created a function that deletes bits.pyc and touch
> > bits.py every time a page is loaded (def GET(self):
> > modules.edit.reload()), but this is always one call behind.
>
> > So the situation looks like this:
>
> > DropdownValues = "Choice1, Choice2"
>
> > a user inserts "Choice3" via a form POST.
> > POST parses the information, inserts "Choice3" into the database,
> > deletes "bits.pyc" (so it must be recompiled), and then renders the
> > template. But the template still has the same information as before.
> > If a user then reloads again, or visits another page on the app, the
> > information is updated on the next load.
>
> > How do I force this to happen each time the page loads so it always
> > has the most recent data? I mean, I could do it through an AJAX call
> > with javascript, but I was trying to go light on the JS since most
> > people in my company use outdated versions of IE and I want to avoid
> > any issues with that.
>
> > Any insight? Thanks.
>
> > On Dec 6, 1:31 pm, Tom <tom.thorog...@gmail.com> wrote:
>
> > > Good Afternoon,
>
> > > I'm working on a really simple database application that will store my
> > > company's branches for easy updating of phone numbers, addresses,
> > > etc.
>
> > > When I add a new branch into the database, web.py doesn't seem to
> > > catch the addition unless I kill the fastcgi process and reload it. I
> > > have cache=False in the render call AND "content="no-cache" in the
> > > META tag of each of the app's pages.
>
> > > When the page loads, it's supposed to pull up one dropdown for each
> > > state in which we have branches (select distinct...from MySQL
> > > database), and one for each city.
>
> > > I really don't understand where else I have to tell it to stop
> > > caching. Is this an SQLite3 issue?
>
> > > Thanks for any assistance.
>
> > > -Tom

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

Reply via email to