Hello,

I'm running into a problem while using the very useful associable module.
Please consider this piece of code:

#########################################

from elixir import *
from elixir.ext.associable import associable

metadata.bind = 'sqlite://'
#metadata.bind.echo = True

class Tag(Entity):
    name = Field(Text())

acts_as_taggable = associable(Tag)

class Article(Entity):
    title = Field(Text())
    acts_as_taggable('tags')

setup_all(True)

tag1 = Tag(name='python')
session.is_modified(tag1)

article = Article(title='Associable is great!')
session.is_modified(article)

#########################################

On my machine, with SQLAlchemy 0.5.2 and Elixir trunk r446, this code
fails with the following error:

Traceback (most recent call last):
  File "associable_test.py", line 22, in <module>
    session.is_modified(article)
  File 
"/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.2-py2.5.egg/sqlalchemy/orm/scoping.py",
line 121, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/SQLAlchemy-0.5.2-py2.5.egg/sqlalchemy/orm/session.py",
line 1460, in is_modified
    (added, unchanged, deleted) = attr.get_history(instance, passive=passive)
  File 
"/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.2-py2.5.egg/sqlalchemy/orm/attributes.py",
line 108, in get_history
    return self.impl.get_history(instance_state(instance), **kwargs)
AttributeError: '_ProxyImpl' object has no attribute 'get_history'

session.is_modified() works fine on the Tag instance but fails on the
Article instance. It seems that the attribute created by associable
misses something. I'm not sure if I'm doing something wrong or if this
is a bug somewhere in Elixir or SQLAlchemy.

Many thanks,
Alex

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

Reply via email to