Hi,
I'm having some problems when combining SA, assign_mapper and the
identity framework.

I moved from using mapper to use assign_mapper when I couldn't figure
out how to use the relations I've created in my models (as described
here: 
http://groups.google.com/group/sqlalchemy/browse_thread/thread/9dc4bcecefd17d23).

After changing model.py, I get the following error for all requests to
the application:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/CherryPy-2.2.1-py2.5.egg/cherrypy/
_cphttptools.py", line 103, in _run
    applyFilters('before_main')
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/CherryPy-2.2.1-py2.5.egg/cherrypy/filters/
__init__.py", line 151, in applyFilters
    method()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/TurboGears-1.0.4b1-py2.5.egg/turbogears/visit/
api.py", line 148, in before_main
    visit = _manager.new_visit_with_key(visit_key)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/TurboGears-1.0.4b1-py2.5.egg/turbogears/visit/
savisit.py", line 48, in new_visit_with_key
    session.save(visit)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/SQLAlchemy-0.3.10-py2.5.egg/sqlalchemy/orm/
session.py", line 417, in save
    self._save_impl(object, entity_name=entity_name)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/SQLAlchemy-0.3.10-py2.5.egg/sqlalchemy/orm/
session.py", line 590, in _save_impl
    self._register_pending(object)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/SQLAlchemy-0.3.10-py2.5.egg/sqlalchemy/orm/
session.py", line 600, in _register_pending
    self._attach(obj)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/SQLAlchemy-0.3.10-py2.5.egg/sqlalchemy/orm/
session.py", line 619, in _attach
    (repr(obj), old, id(self)))
InvalidRequestError: Object '<tnf.model.Visit object at 0x2430650>' is
already attached to session '37947088' (this is '37947024')

So it seems that when you're using assign_mapper, you must use the
"visit.save()" form rather than "session.save(visit)". Is that true?

I'd really appreciate some help in resolving the above error, or
failing that, advice on how I can use my object relations without
resorting to assign_mapper (I'm sure it must be possible...).

Thanks!
James


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to