Deprecated methods

4 views
Skip to first unread message

Juan Manuel Garcia

unread,
Nov 25, 2011, 4:03:42 PM11/25/11
to SQLElixir
Hi elixir developers,

I was reading the code of the svn repo and I see this:


# This bunch of session methods, along with all the query methods
below
# only make sense when using a global/scoped/contextual session.
@property
def _global_session(self):
return self._descriptor.session.registry()

#FIXME: remove all deprecated methods, possibly all of these
def merge(self, *args, **kwargs):
return self._global_session.merge(self, *args, **kwargs)

def save(self, *args, **kwargs):
return self._global_session.save(self, *args, **kwargs)

def update(self, *args, **kwargs):
return self._global_session.update(self, *args, **kwargs)

# only exist in SA < 0.5
# IMO, the replacement (session.add) doesn't sound good enough to
be added
# here. For example: "o = Order(); o.add()" is not very telling.
It's
# better to leave it as "session.add(o)"
def save_or_update(self, *args, **kwargs):
return self._global_session.save_or_update(self, *args,
**kwargs)


The method save from the class sqlalchemy.orm.scoping.ScopedSession is
no longer supported in the latest version of sqlalchemy. This also
stands for the save_or_update method.
This code causes that user wich calls the save method in a entity
object get an exception like this:


File "/usr/local/lib/python2.6/dist-packages/Elixir-0.8.0dev_r534-
py2.6.egg/elixir/entity.py", line 983, in save
return self._global_session.save(self, *args, **kwargs)
AttributeError: 'Session' object has no attribute 'save'


I think we should remove these methods or show a deprecation warning
to users, but without crashing the program like now.
What do you think?

Reply all
Reply to author
Forward
0 new messages