Hi,

When executing the following program, changes in the database (other
than those made by this program) aren't visible until it is restarted,
due to some form of SQLAlchemy caching:

from twisted.web import server, resource
import model # my database model

class MyRoot(resource.Resource):
 def render(self, request):
   m = model.MyModel.get(request.args['id'][0])
   return m.some_column

# Connect to database.
model.metadata.connect('some_dburi')

# Create site structure.
root = resource.Resource()
root.putChild('', MyRoot())
site = server.Site(root)

# Switch user, start service.
from twisted.application import service, strports
application = service.Application("myexample")
s = strports.service('tcp:8080', site)
s.setServiceParent(application)

So if I visit http://localhost:8080/?id=1, then alter the some_column
value for the row who's id is 1 and reload, the change is not
reflected.

Problem is, I need the update to be visible. How would I go about
implementing this?

Regards,
Magnus

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to