Kevin Dangoor wrote:
> 7) the atomic weight of cesium remains 132.90543. I figured it's not a
> good idea to change that one :)

Oh good, I was a bit worried about that.

So, this stuff still seems to be missing some necessary saving and
flushing of the objects.  I don't know if it's necessary to manage
these in a separate transaction to avoid committing other changes made
by the users' apps, but here's a basic patch to get the login and
logout working on a quickstarted project:

Index: turbogears/identity/saprovider.py
===================================================================
--- turbogears/identity/saprovider.py   (revision 1606)
+++ turbogears/identity/saprovider.py   (working copy)
@@ -93,10 +93,11 @@
             session.delete(visit)
             # Clear the current identity
             anon = SqlAlchemyIdentity(None,None)
-            anon.anonymous = True
             identity.set_current_identity(anon)
         except:
             pass
+        else:
+            session.flush()


 class SqlAlchemyIdentityProvider(object):
@@ -163,8 +164,10 @@
         link = visit_class.get_by(visit_key=visit_key)
         if not link:
             link = visit_class(visit_key=visit_key,
user_id=user.user_id)
+            session.save(link)
         else:
             link.user_id = user.user_id
+        session.flush()
         return SqlAlchemyIdentity(visit_key, user)

     def load_identity(self, visit_key):
Index: turbogears/visit/savisit.py
===================================================================
--- turbogears/visit/savisit.py (revision 1606)
+++ turbogears/visit/savisit.py (working copy)
@@ -5,6 +5,7 @@

 from turbogears.visit.api import BaseVisitManager, Visit
 from turbogears import config
+from turbogears.database import session, get_engine
 from turbogears.util import load_class

 import logging
@@ -26,7 +27,9 @@

     def new_visit_with_key(self, visit_key):
         visit = visit_class(visit_key=visit_key,
-                        expiry=datetime.now()+self.timeout)
+                            expiry=datetime.now()+self.timeout)
+        session.save(visit)
+        session.flush()
         return Visit(visit_key, True)

     def visit_for_key(self, visit_key):
@@ -46,11 +49,12 @@
         # TODO this should be made transactional
         table = visit_class.table
         # Now update each of the visits with the most recent expiry
+        engine = get_engine()
         for visit_key,expiry in queue.items():
             log.info("updating visit (%s) to expire at %s", visit_key,
                       expiry)
-            table.update(table.c.visit_key==visit_key,
-                              values={'expiry': expiry}).execute()
+            engine.execute(table.update(table.c.visit_key==visit_key,
+                           values={'expiry': expiry}))
 
 class TG_Visit(ActiveMapper):
   class mapping:


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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/turbogears-trunk
-~----------~----~----~----~------~----~------~--~---

Reply via email to