[Zope-dev] New ways of getting transactions?

2005-12-11 Thread Morten W. Petersen
Hi,

I'm having some code that bombs out trying to commit a transaction;  I
believe it's because of new ways of doing things in Zope 2.9..  how do
you call the equivalents of get_transaction().commit() and abort() in
Zope 2.9?  Will those new ways work with Zope 2.7/2.8?

Thanks.

-- 
Morten W. Petersen

Email: [EMAIL PROTECTED]
Phone: +47 45 44 00 69
Title: Project manager

Nidelven IT (http://www.nidelven-it.no)
We provide Zope/Plone hosting and consulting
begin:vcard
fn:Morten Petersen
n:Petersen;Morten
org:Nidelven IT
adr:;;Postboks 923;Trondheim;;7409;Norway
email;internet:[EMAIL PROTECTED]
title:Project Manager
tel;work:+47 45 44 00 69
tel;cell:+47 45 44 00 69
x-mozilla-html:FALSE
url:http://www.nidelven-it.no
version:2.1
end:vcard

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Jim Fulton

Morten W. Petersen wrote:

Hi,

I'm having some code that bombs out trying to commit a transaction;  I
believe it's because of new ways of doing things in Zope 2.9..  how do
you call the equivalents of get_transaction().commit() and abort() in
Zope 2.9?  Will those new ways work with Zope 2.7/2.8?


import transaction
...

transaction.commit()
transaction.abort()

Although I think the old way should still work.  If it doesn't,
please report a bug.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Stefan H. Holek

import transaction
transaction.get()
transaction.commit()
transaction.abort()
transaction.savepoint()

This works since 2.8, but not in 2.7. Nearly every project has come  
up with its own backward compatibility module though. See for example  
CMFCore.utils.transaction or CMFPlone.transaction.


Stefan


On 11. Dez 2005, at 17:01, Morten W. Petersen wrote:


Hi,

I'm having some code that bombs out trying to commit a transaction;  I
believe it's because of new ways of doing things in Zope 2.9..  how do
you call the equivalents of get_transaction().commit() and abort() in
Zope 2.9?  Will those new ways work with Zope 2.7/2.8?

Thanks.

--
Morten W. Petersen


--
Anything that happens, happens.  --Douglas Adams


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Jim Fulton

Stefan H. Holek wrote:

import transaction
transaction.get()
transaction.commit()
transaction.abort()
transaction.savepoint()

This works since 2.8, but not in 2.7. Nearly every project has come  up 
with its own backward compatibility module though. See for example  
CMFCore.utils.transaction or CMFPlone.transaction.


I'm dispayed to hear this. :(  The old use of __builtins__.get_transaction
should be deprecated and supported for a period of time.  If it isn't, then this
is *definately* a bug.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Morten W. Petersen
>> This works since 2.8, but not in 2.7. Nearly every project has come 
>> up with its own backward compatibility module though. See for example 
>> CMFCore.utils.transaction or CMFPlone.transaction.
> 
> 
> I'm dispayed to hear this. :(  The old use of __builtins__.get_transaction
> should be deprecated and supported for a period of time.  If it isn't,
> then this is *definately* a bug.

I agree.  I've reported it as a bug:

http://www.zope.org/Collectors/Zope/1965

-- 
Morten W. Petersen

Email: [EMAIL PROTECTED]
Phone: +47 45 44 00 69
Title: Project manager

Nidelven IT (http://www.nidelven-it.no)
We provide Zope/Plone hosting and consulting
begin:vcard
fn:Morten Petersen
n:Petersen;Morten
org:Nidelven IT
adr:;;Postboks 923;Trondheim;;7409;Norway
email;internet:[EMAIL PROTECTED]
title:Project Manager
tel;work:+47 45 44 00 69
tel;cell:+47 45 44 00 69
x-mozilla-html:FALSE
url:http://www.nidelven-it.no
version:2.1
end:vcard

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Andreas Jung



--On 11. Dezember 2005 17:01:56 +0100 "Morten W. Petersen" 
<[EMAIL PROTECTED]> wrote:



Hi,

I'm having some code that bombs out trying to commit a transaction;  I
believe it's because of new ways of doing things in Zope 2.9..  how do
you call the equivalents of get_transaction().commit() and abort() in
Zope 2.9?  Will those new ways work with Zope 2.7/2.8?




See doc/ZODB.txt. Of course the new API will not work in Zope 2.7/2.8.

-aj

pgpbsHnd6aIix.pgp
Description: PGP signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Andreas Jung



--On 11. Dezember 2005 12:28:04 -0500 Jim Fulton <[EMAIL PROTECTED]> wrote:


Stefan H. Holek wrote:

import transaction
transaction.get()
transaction.commit()
transaction.abort()
transaction.savepoint()

This works since 2.8, but not in 2.7. Nearly every project has come  up
with its own backward compatibility module though. See for example
CMFCore.utils.transaction or CMFPlone.transaction.


I'm dispayed to hear this. :(  The old use of __builtins__.get_transaction
should be deprecated and supported for a period of time.  If it isn't,
then this


The deprecation warning in Zope 2.8 says:

-c:1: DeprecationWarning: This will be removed in ZODB 3.6:
  use transaction.get() instead of get_transaction().
  transaction.commit() is a shortcut spelling of 
transaction.get().commit(),

  and transaction.abort() of transaction.get().abort().

Zope 2.9 comes with ZODB 3.6. So the behaviour is correct in some way but I 
agree that the deprecation should continue longer. It would be save to 
remove it in Zope 2.10.


-aj


pgpUKqZDyxiF7.pgp
Description: PGP signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Tim Peters
A number of ZODB gimmicks were officially deprecated in ZODB 3.4, and
removed in ZODB 3.6.  Zope 2.9 uses the latter.  From the ZODB NEWS
file for 3.6:

"""
Removal of Features Deprecated in ZODB 3.4
--

(3.6b2) ZODB 3.6 no longer contains features officially deprecated in the
ZODB 3.4 release.  These include:

- ``get_transaction()``.  Use ``transaction.get()`` instead.
  ``transaction.commit()`` is a shortcut spelling of
  ``transaction.get().commit()``, and ``transaction.abort()``
  of ``transaction.get().abort()``.  Note that importing ZODB no longer
  installs ``get_transaction`` as a name in Python's ``__builtin__``
  module either.

- The ``begin()`` method of ``Transaction`` objects.  Use the ``begin()``
  method of a transaction manager instead.  ``transaction.begin()`` is
  a shortcut spelling to call the default transaction manager's ``begin()``
  method.

- The ``dt`` argument to ``Connection.cacheMinimize()``.

- The ``Connection.cacheFullSweep()`` method.  Use ``cacheMinimize()``
  instead.

- The ``Connection.getTransaction()`` method.  Pass a transaction manager
  to ``DB.open()`` instead.

- The ``Connection.getLocalTransaction()`` method.  Pass a transaction
  manager to ``DB.open()`` instead.

- The ``cache_deactivate_after`` and ``version_cache_deactivate_after``
  arguments to the ``DB`` constructor.

- The ``temporary``, ``force``, and ``waitflag`` arguments
  to ``DB.open()``.  ``DB.open()`` no longer blocks (there's no longer
  a fixed limit on the number of open connections).

- The ``transaction`` and ``txn_mgr``arguments to ``DB.open()``.  Use
  the ``transaction_manager`` argument instead.

- The ``getCacheDeactivateAfter``, ``setCacheDeactivateAfter``,
  ``getVersionCacheDeactivateAfter`` and ``setVersionCacheDeactivateAfter``
  methods of ``DB``.
"""
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Jim Fulton

Andreas Jung wrote:



--On 11. Dezember 2005 12:28:04 -0500 Jim Fulton <[EMAIL PROTECTED]> wrote:


Stefan H. Holek wrote:


import transaction
transaction.get()
transaction.commit()
transaction.abort()
transaction.savepoint()

This works since 2.8, but not in 2.7. Nearly every project has come  up
with its own backward compatibility module though. See for example
CMFCore.utils.transaction or CMFPlone.transaction.



I'm dispayed to hear this. :(  The old use of 
__builtins__.get_transaction

should be deprecated and supported for a period of time.  If it isn't,
then this



The deprecation warning in Zope 2.8 says:

-c:1: DeprecationWarning: This will be removed in ZODB 3.6:
  use transaction.get() instead of get_transaction().
  transaction.commit() is a shortcut spelling of 
transaction.get().commit(),

  and transaction.abort() of transaction.get().abort().

Zope 2.9 comes with ZODB 3.6. So the behaviour is correct in some way 
but I agree that the deprecation should continue longer. It would be 
save to remove it in Zope 2.10.


Yup.

BTW, This is a good example for why I want to start using time-based
deprecation.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Tim Peters
[Jim Fulton]
...
> BTW, This is a good example for why I want to start using time-based
> deprecation.

In a world with time-based releases, is there a difference?
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] New ways of getting transactions?

2005-12-11 Thread Jim Fulton

Tim Peters wrote:

[Jim Fulton]
...


BTW, This is a good example for why I want to start using time-based
deprecation.



In a world with time-based releases, is there a difference?


Yes, because release numbers aren't very helpful when software
is used by many applications.  For example, I could imagine
bumping ZODB (or some other packages) release numbers more often than
is needed by Zope. For example, zope.interface has separate releases.
We might someday decide to make a release to meet Twisted's needs.
We wouldn't want such an incedental event to cause a feature to
be deprecated more quickly.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )