Hi,

On Wed, Dec 1, 2010 at 1:40 PM, Mohammad <[email protected]> wrote:

> Hi,
> I saw the document and now it works fine with CRUD functionality.
> But i disappointed to use it in my PyCrust Python IDE.
> Earlier i used to connect to db to call my customized functions
> quickly.
> But here we always have to call any Function within the Transaction
> method.
> But it worths according to the advantages of using Transaction method
> probably.
> Maybe it is time for me to migrate to this Poteus , A client library
> to work with ORM.
> Thanks Cedric,
>

I dont know why you are "disappointed" with the transaction change and with
statement.

The syntax for with statement is here:
http://docs.python.org/reference/compound_stmts.html#the-with-statement
The transaction implementation is here:
http://hg.tryton.org/1.8/trytond/file/08867d5bf793/trytond/transaction.py

You can replace the following with usage with:

'''
with Transaction().start(DBNAME, 0, None):
    # Do something
'''

"""
Transaction().start(DBNAME, 0, None)
# Do Something
Transaction().stop()
"""

which is exactly what the Transaction manager does


>
> On Dec 1, 3:28 pm, Cédric Krier <[email protected]> wrote:
> > On 30/11/10 23:10 -0800, Mohammad wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > But When i used the simple method like below one the error message
> > > apprears and i think it is related to Cache :(
> > > ===========================================================
> > > >>party_obj = POOL.get('party.party')
> > > >>party_obj.browse([1])
> > > Traceback (most recent call last):
> > >   File "<input>", line 1, in <module>
> > >   File "/home/mohammad/workspace/tryton-dist/trytond1.8/trytond/
> > > trytond/model/modelstorage.py", line 507, in browse
> > >     for x in ids))
> > >   File "/home/mohammad/workspace/tryton-dist/trytond1.8/trytond/
> > > trytond/model/browse.py", line 15, in __init__
> > >     super(BrowseRecordList, self).__init__(lst)
> > >   File "/home/mohammad/workspace/tryton-dist/trytond1.8/trytond/
> > > trytond/model/modelstorage.py", line 507, in <genexpr>
> > >     for x in ids))
> > >   File "/home/mohammad/workspace/tryton-dist/trytond1.8/trytond/
> > > trytond/model/browse.py", line 55, in __init__
> > >     cache = self._cursor.get_cache(self._context)
> > > AttributeError: 'NoneType' object has no attribute 'get_cache'
> >
> > > =======================================================================
> >
> > You should take a look athttp://
> code.google.com/p/tryton/wiki/HowToUseTrytondAsAModule#Version...
> >
> > You must use now Transaction manager.
> >
> > --
> > Cédric Krier
> >
> > B2CK SPRL
> > Rue de Rotterdam, 4
> > 4000 Liège
> > Belgium
> > Tel: +32 472 54 46 59
> > Email/Jabber: [email protected]
> > Website:http://www.b2ck.com/
> >
> >  application_pgp-signature_part
> > < 1KViewDownload
>
> --
> [email protected] mailing list
>



-- 
Sharoon Thomas
Business Analyst & Open Source ERP Consultant
CEO @ http://openlabs.co.in

-- 
[email protected] mailing list

Reply via email to