Russ,

2007/7/21, Russell Keith-Magee <[EMAIL PROTECTED]>:

> > Therefore,
> > can anybody point me to some tutorial/documentation on how to do this
> > kind of meta programming in Python?
>
> Google is your friend.

Well, that friend is sometimes too unspecific or too helpful and
overwhelming. Your pointer to the newforms code is more what I hoped
for. Thanks.

> > Additionally, I
> > need transactions to be able to revert partial modifications of single
> > method calls. It is my current understanding that Django does not have
> > this feature.
>
> Which feature? Transactions? Django definitely has those:
>
> http://www.djangoproject.com/documentation/transactions/

I was talking about object-level transaction. Here is my test code:

 # models.py
 class Foo(models.Model):
   count = models.IntegerField()

 # tests.py

 @transaction.commit_manually
 def test(foo):
   foo.count += 1
   transaction.rollback()

 class Test(unittest.TestCase):
   def test_transactions(self):
     foo = Foo(count=1)
     test(foo)
     self.assertEqual(1, foo.count)

The above code will fail. The count isn't reset to 1. It doesn't
matter whether I save the object or not.

-- 
Stefan Matthias Aust

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to