I have a perplexing problem and I'm really hopping that there is a
setting or something stupid that I've missed. Here is the issue, I
have an application most of my page data is coming from a postgres
database. I've designed an admin interface which allows you to edit
the database, however, when I leave the admin interface and look at
the page as a normal user, I see old data, not the new data. If I
look at the database directly with pgadmin the new data has been
entered. I am using postgres, python 2.4 pylons 0.9.6 rc2. Here is
some example code:
ini file:
sqlalchemy.default.url = postgres://user:[EMAIL PROTECTED]/epathology
model:
from sqlalchemy import *
from sqlalchemy.orm import *
form sqlalchemy.ext.assignmapper import assign_mapper
from sacontext import PylonsSAContext
sac = PylonsSAContext()
sac.add_engine_from_config('default')
ctx = sac.session_context
table1 = Table('table1', sac.metadata, autoload=True)
class Table1(object):
pass
assign_mapper(ctx, Table1, table1, extension=sac.ext)
to set data I do:
rec = model.Table1.get(id)
rec.someattribute = "new value"
rec.save() # I has not been doing this initially, I just added this
to see if it would help, it did not
model.sac.session.flush()
to get data I do:
data = model.rec.select()
This seems to work, however like I said when I edit the data more
often then not the application reflects old data, like its getting
data from a cache or using an old session to retrieve data from. What
am I doing wrong? this is really frustrating. Well thanks for any and
all help
Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---