I have a model like that:

#models.py

import sqlalchemy.mods.threadlocal
from sqlalchemy import *

metadata =
BoundMetaData('mysql://root:[EMAIL PROTECTED]@localhost/django')
metadata.engine.echo = True

wikis = Table('wiki_wiki', metadata,
              Column('id', Integer, primary_key=True),
              Column('pagename', String(20), unique=True),
              Column('content', TEXT))

# These are the classes that will become our data classes
class Wiki(object):
    @classmethod
    def by_pagename(cls, pagename):
        return
objectstore.context.current.query(cls).select_by(pagename=pagename)

    @classmethod
    def firstby_pagename(cls, pagename):
        return
objectstore.context.current.query(cls).selectfirst_by(pagename=pagename)

    def save(self):
        return objectstore.context.current.save(self)

    def flush(self):
        return objectstore.context.current.flush([self, ])

mapper(Wiki, wikis)

then I write a web application to view&modify wiki's contents, the code
like that:
    #view
    pages = Wiki.by_pagename(pagename)
    if pages:
     return pages[0].content
    #edit
    pages = Wiki.by_pagename(pagename)
    if pages:
        pages[0].content = content
        pages[0].flush()
I configure apache + mod_python for run the web application, i meet a
very strange problem, I have a wiki which contents is "test", then I
modify it contents to "test2", I also print the current process id, I
found that distinct apache process show diffrent result, some show
"test", some show "test2", but the right should be 'test2", is
objectstore has cache or some other reason?

thanks!


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

Reply via email to