Sorry to be a pain but, could this thread be continued (if it's going to be) on 
Django Users?




(sorry)



—

On Wed, Aug 5, 2015 at 3:59 PM, Marcin Nowak <marcin.j.no...@gmail.com>
wrote:

> Hi Aymeric,
> This project is complex, as I said before, and works well with Django 1.4. 
> But we need to upgrade it to newer version because of lack of support, 
> security issues, and simplifcation of maintenance and growth (we're 
> currently using three different Django versions, from 1.4 to 1.7, and we've 
> decided to upgrade all subprojects to 1.8)
> commit_manually() is used within long-live processes running as a mgmt 
> commands, where is used multiprocessing too.
> Whole process is complicated and hard to maintain. I would like to avoid 
> logical / flow changes, whose are required to replace commit_manually() 
> with atomic().
> Second use case is a extract-transform-load subsytem, which also requires 
> precise development of queries, commits and rollbacks. I'm afraid that 
> upgrade of it may be also hard.
> I think that there are rare cases, when manual transaction handling is 
> required and should be available for punctilious developer.
> *BUT* I can't say that atomic() does not fit my needs. I know how it work 
> (I belive), but it may not cover current cases (implementation).
> I must try to do replacement or bring old behaviour of commit_manually() 
> with my custom wrapper. I'm trying to change code as less as possible.
> You're asking what could be done better.. Generally speaking - an API 
> compatibility layer. As a maintainer of big and old project I would like to 
> import "commit_manually" from special module delivered with Django, which 
> will guarantee stability and compatibility. This may be even undocumented. 
> Manual commit() and rollback() functions are provided in transaction module 
> (thanks so much for that!), so making compat layer should be possible, I 
> think.
> Kind Regards,
> Marcin
> On Wednesday, August 5, 2015 at 1:16:38 PM UTC+2, Aymeric Augustin wrote:
>>
>> On 5 août 2015, at 11:09, Marcin Nowak <marcin....@gmail.com <javascript:>> 
>> wrote: 
>>
>> > I'm using commit_manually() frequently, but this decorator was 
>> removed... 
>>
>> Hi Marcin, 
>>
>> Sorry for derailing the discussion a bit, but could you clarify why you 
>> were 
>> using this API? I removed it after failing to find a use case where it 
>> would 
>> be preferrable to commit_on_success(). I’d love to know if I missed 
>> something 
>> in order to avoid making similar mistakes again. 
>>
>> Using commit_manually() properly required great care -- and a try/finally 
>> construct in practice -- to ensure that no code path escaped without a 
>> commit 
>> or a rollback. It also required a massive amount of boilerplate to avoid 
>> masking exceptions: 
>>
>> - 
>> https://groups.google.com/d/msg/django-developers/S3a5UAqAsmg/7C27UGl6G_0J 
>> - https://code.djangoproject.com/ticket/6623 
>>
>> If you replace it with transaction.atomic() and remove the boilerplate, 
>> you 
>> get the same behavior with ten times less code. 
>>
>> In case removing the boilerplate creates too much code churn, I documented 
>> a 
>> real drop-in replacement that doesn't have the drawbacks of 
>> commit_manually: 
>> https://docs.djangoproject.com/en/1.6/topics/db/transactions/#id5 
>>
>> What could I have done better? 
>>
>> If you don't want any changes in Django -- your posts to this list are 
>> often 
>> after-the-fact complains about new features -- perhaps you could stick 
>> with 
>> whatever version of Django you're currently running? 
>>
>> -- 
>> Aymeric. 
>>
>>
>>
>>
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers  (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/3257c139-f52e-422f-8eb4-5a97771ca367%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1438783672435.73354761%40Nodemailer.
For more options, visit https://groups.google.com/d/optout.

Reply via email to