Erik Bray wrote:
> ...
> Much, much nicer than having to write:
> def _foo(self, env, db=None):
>     ...
> def foo(self, env, db=None):
>     transaction(env, db, self._foo)
>
> over and over and over again...
>   

Not really. If you look carefully at the changeset, you'll see that the 
_foo and foo methods aren't the same.
The foo (like "delete") does a transaction, then notifies the listeners 
(and that needs to be outside the transaction).

However, this is not the final form, it can be simplified further.
I only used a secondary foo_ method in order to minimize the changes to 
model.py, something wise to do for branches...

The final form will look something like:

    def delete(self, version=None, db=None):
        assert self.exists, 'Cannot delete non-existent page'
        def delete():
            # insert here the current self._delete code
        transaction(self.env, db, self._delete, version)

        # Let change listeners know about the deletion
        if not self.exists:
            ....

Which leaves some room for improvement once depending on 2.5, by using 
"with" and an adequate context manager.
I hope this better explains the change.

-- Christian

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

Reply via email to