pombreda / formalchemy

Automatically exported from code.google.com/p/formalchemy
MIT License
0 stars 0 forks source link

AttributeError: 'ScopedSession' object has no attribute 'update' #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi!
I'm using pylons 0.9.7 and FormAlchemy 1.3.1
Creating and deleting records are ok, but when update a record, we get the
error: AttributeError: 'ScopedSession' object has no attribute 'update'

With the next modification of ext/pylons/controller.py file, the record is
correctly udpate (line #78):

    def sync(self, fs, id=None):
        """sync a record. If ``id`` is None add a new record else save
current one.

        Default is::

            S = self.Session()
            if id:
                S.update(fs.model)
            else:
                S.add(fs.model)
            S.commit()
        """
        S = self.Session()
        if id:
            pass #S.update(fs.model)
        else:
            S.add(fs.model)
        S.commit()

Sorry, but I am newbie with SQLAlchemy and FormALchemy and I do not know
why it occurs.

Regards
Gins

Original issue reported on code.google.com by gins...@gmail.com on 1 Mar 2010 at 2:39

GoogleCodeExporter commented 9 years ago
Yes. Look like SQLAlchemy's api have changed.
I've fixed that yesterday:

http://code.google.com/p/formalchemy/source/browse/formalchemy/ext/pylons/contro
ller.py#64

Original comment by gael.pas...@gmail.com on 1 Mar 2010 at 2:44

GoogleCodeExporter commented 9 years ago
Fine! you're too fast ;)

Original comment by gins...@gmail.com on 1 Mar 2010 at 2:50