Working towards a simpler GCBV implementation?

2013-10-03 Thread Yo-Yo Ma
I'm excited about Django Vanilla Views. I think the GCBV implementation in 
Django is pretty good (I use GCBV got everything - leads to better 
extensibility), but a simpler version of the same functionality would be great. 
I'm NEVER certain of whether I'm using the right mixins and base class combos, 
or if I have them in the right inheritance order, or which share the same 
function, etc.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/504d0c8e-2359-4577-b484-5006d09ca770%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: IRC users invited to support PyCon Ireland Django sprinters

2013-10-03 Thread Marc Tamlyn
As an FYI, I will also be on site for the sprints, hopefully covering some
more experienced contributors, and working through some patches I said I'd
review (hi Loic!) but haven't yet.

Marc
On 3 Oct 2013 17:00, "Daniele Procida"  wrote:

> I'm running a "Don't be afraid to commit workshop" at PyCon Ireland. The
> sprints will be on 14th to 15th October - <
> http://python.ie/pycon/2013/schedule/>.
>
> Last time it worked brilliantly well having a few active people in
> #django-sprint. If anyone can be around for the next one, that would be
> wonderful.
>
> Thanks,
>
> Daniele
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" 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/20131003160004.574033262%40smtp.ntlworld.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/CAMwjO1FFJj8ULCWaztrEG6%2BMgtgbfE5BRV_rRYSoMOmDJ-hZtw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


IRC users invited to support PyCon Ireland Django sprinters

2013-10-03 Thread Daniele Procida
I'm running a "Don't be afraid to commit workshop" at PyCon Ireland. The 
sprints will be on 14th to 15th October - 
.

Last time it worked brilliantly well having a few active people in 
#django-sprint. If anyone can be around for the next one, that would be 
wonderful.

Thanks,

Daniele

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/20131003160004.574033262%40smtp.ntlworld.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AbstractUser to get more abstract

2013-10-03 Thread Rocky Meza
Hey Russ,

On Monday, September 30, 2013 7:17:14 PM UTC-6, Russell Keith-Magee wrote:
>
> Hi Rocky,
>
> On Thu, Sep 26, 2013 at 4:17 PM, Rocky Meza  > wrote:
>
>>
>> Hi,
>>
>> I'm another one of the authtools devs.
>>
>> On Tuesday, September 24, 2013 6:04:17 PM UTC-6, Luke Sneeringer wrote:
>>>
>>> Good evening, Russell, et. al.,
>>> This is a problem that we ran into with authtools, what we ended up 
>>> doing was just running the tests 3 times[1].  I don't think this is a 
>>> realistic approach within Django core though.  One of the main problems 
>>> with this is that you use get_user_model at the root level of the forms 
>>> module, so the Form will be declared against only one model--I don't know 
>>> what you can do though.  Having email_auth as a separate app would probably 
>>> clear up this problem for the tests, but if that happens then we would just 
>>> have to concrete specific sets of forms, instead of more generic Forms, 
>>> which was the whole idea.  The only situation where you should be switching 
>>> settings around is in tests, so I do think it is a little unfair to 
>>> compromise the generic nature of the forms just to appease the tests.
>>>
>>
>>> Not only is it a realistic approach -- it is (within limits) what the 
> current Django core already does. In order to validate that Django's 
> pluggable user infrastructure actually does what it is supposed to do 
> (i.e., let people with different user models use default auth views etc), 
> Django's auth app ships 7 test User models, and large chunks of the test 
> suite are run for each of those models. It's not a case of running the 
> *entire* auth test suite repeatedly; it's matter of finding the parts of 
> logic that are User model dependent, and running *those* tests repeatedly. 
>
Oh that's cool, I didn't know that.  That makes some things easier.

>
> So - it's entirely possible and realistic - as long as you don't bind one 
> specific User model into a global context. Which is one of the reasons why 
> having a separate app helps :-)
>
> Yours,
> Russ Magee %-)
>

-rocky 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/7075f774-3576-4716-b5d2-d5e3354474ef%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Permission to use some Django material ?

2013-10-03 Thread Stan


On Thursday, October 3, 2013 11:17:49 AM UTC+2, Tom Christie wrote:
>
> Hi Stan,
>
> I would simply include some text in the license noting that some images 
> are taken from the Django source and their usage is subject to it's 
> license, with a link to the Django license.  I'm sure that'd be plenty 
> sufficient attribution.
>

Sounds like a decent solution. Many thanks.

Stanislas.

 

>
> All the best,
>
>   Tom
>
> On Thursday, 3 October 2013 10:13:03 UTC+1, Stan wrote:
>>
>> Thanks Russ,
>>
>> Do you know if there is a best way to "suitably attribute" images ? Maybe 
>> a text file beside REAME.txt / LICENCE.txt ?
>>
>> Cheers,
>>
>> Stanislas
>>
>> On Thursday, October 3, 2013 11:02:04 AM UTC+2, Russell Keith-Magee wrote:
>>>
>>> Hi Stanislas,
>>>
>>> Django is licensed under the terms of the BSD license. This means you 
>>> can use any of Django's source code -- including images -- for whatever 
>>> purpose, commercial or otherwise, as long as whatever you use is suitably 
>>> attributed, and you don't make any claims that what you've done is endorsed 
>>> by Django or it's contributors.
>>>
>>> The license text itself is quite easy to read:
>>>
>>> https://github.com/django/django/blob/master/LICENSE
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>>
>>> On Thu, Oct 3, 2013 at 4:28 PM, Stan  wrote:
>>>
 Hi,

 I am working on a small app providing Ajax search for a 
 ModelChoiceFieldLike in addition to an admin-like related lookup (pop up 
 to 
 changelist). Is it possible for me to embed the magnifier image from admin 
 statics ? (static/admin/img/selector-search.gif)

 Thanks.

 Stanislas.

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django developers" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-develop...@googlegroups.com.
 To post to this group, send email to django-d...@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/2d566ef5-c4a2-4801-ac42-da77506b7603%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/ac4196ba-f7fc-4bb2-83f3-e060c65e2cec%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Idea about authentication

2013-10-03 Thread Florian Apolloner
We already committed a fix for pbkdf2, the DOS vector no longer exists (at 
least not in this form): 
https://github.com/django/django/commit/68540fe4df44492571bc610a0a043d3d02b3d320
 


On Thursday, October 3, 2013 9:56:14 AM UTC+2, Ram Rachum wrote:
>
> Hi everybody,
>
> I've submitted the patch, and corrected it, and it's been sitting on the 
> issue tracker for 2 weeks without anyone commenting. Does anyone care to 
> discuss this? I want to have this merged in, or discuss any problems in 
> merging it in. 
>
>
> On Sun, Sep 15, 2013 at 11:27 PM, Ram Rachum  > wrote:
>
>> Submitted patch:
>>
>> https://code.djangoproject.com/ticket/21105#comment:1
>>
>> On Sunday, September 15, 2013 10:09:55 PM UTC+3, Donald Stufft wrote:
>>
>>>
>>> On Sep 15, 2013, at 2:59 PM, Florian Apolloner  
>>> wrote:
>>>
>>> Hi Ram,
>>>
>>> On Sunday, September 15, 2013 12:34:03 PM UTC+2, Ram Rachum wrote:

 Florian, I'm not sure that you read my message carefully enough. I'm *not 
 *proposing to reduce the time that PBKDF2  takes to hash.

>>>
>>> By replacing the password with a hash before running it through PBKDF2 
>>> you are reducing that time for every password longer than the hash… And 
>>> given the way PBKDF2 works you'll reduce it by quite a bit (note that all 
>>> of this only applies to passwords longer than the hash, so it's probably 
>>> pretty academical). Either way, we'd at least need a new hasher class since 
>>> it would be backwards incompatible. Independent of that we'd have to 
>>> evaluate if pre-hashing the password could make  PBKDF2 less secure 
>>> (probably not to likely, but who knows).
>>>
>>>
>>> According to Thomas Porin in the context of bcrypt pre-hashing the 
>>> password is fine (and we already do this in Django 1.6). I see no reason 
>>> the same wouldn't hold true for PBKDF2.
>>>
>>> -
>>> Donald Stufft
>>> PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 
>>> DCFA 
>>>
>>>  -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django developers" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-developers/iuSE5Y4R3hg/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> django-develop...@googlegroups.com .
>> To post to this group, send email to 
>> django-d...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-developers.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/48f1d111-e8e0-4c16-bec3-1af1cd1aa1f9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Permission to use some Django material ?

2013-10-03 Thread Tom Christie
Hi Stan,

I would simply include some text in the license noting that some images are 
taken from the Django source and their usage is subject to it's license, 
with a link to the Django license.  I'm sure that'd be plenty sufficient 
attribution.

All the best,

  Tom

On Thursday, 3 October 2013 10:13:03 UTC+1, Stan wrote:
>
> Thanks Russ,
>
> Do you know if there is a best way to "suitably attribute" images ? Maybe 
> a text file beside REAME.txt / LICENCE.txt ?
>
> Cheers,
>
> Stanislas
>
> On Thursday, October 3, 2013 11:02:04 AM UTC+2, Russell Keith-Magee wrote:
>>
>> Hi Stanislas,
>>
>> Django is licensed under the terms of the BSD license. This means you can 
>> use any of Django's source code -- including images -- for whatever 
>> purpose, commercial or otherwise, as long as whatever you use is suitably 
>> attributed, and you don't make any claims that what you've done is endorsed 
>> by Django or it's contributors.
>>
>> The license text itself is quite easy to read:
>>
>> https://github.com/django/django/blob/master/LICENSE
>>
>> Yours,
>> Russ Magee %-)
>>
>>
>> On Thu, Oct 3, 2013 at 4:28 PM, Stan  wrote:
>>
>>> Hi,
>>>
>>> I am working on a small app providing Ajax search for a 
>>> ModelChoiceFieldLike in addition to an admin-like related lookup (pop up to 
>>> changelist). Is it possible for me to embed the magnifier image from admin 
>>> statics ? (static/admin/img/selector-search.gif)
>>>
>>> Thanks.
>>>
>>> Stanislas.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django developers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-develop...@googlegroups.com.
>>> To post to this group, send email to django-d...@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/2d566ef5-c4a2-4801-ac42-da77506b7603%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/ae579780-fd75-4fa5-8fd0-c884183a7c3e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Permission to use some Django material ?

2013-10-03 Thread Stan
Thanks Russ,

Do you know if there is a best way to "suitably attribute" images ? Maybe a 
text file beside REAME.txt / LICENCE.txt ?

Cheers,

Stanislas

On Thursday, October 3, 2013 11:02:04 AM UTC+2, Russell Keith-Magee wrote:
>
> Hi Stanislas,
>
> Django is licensed under the terms of the BSD license. This means you can 
> use any of Django's source code -- including images -- for whatever 
> purpose, commercial or otherwise, as long as whatever you use is suitably 
> attributed, and you don't make any claims that what you've done is endorsed 
> by Django or it's contributors.
>
> The license text itself is quite easy to read:
>
> https://github.com/django/django/blob/master/LICENSE
>
> Yours,
> Russ Magee %-)
>
>
> On Thu, Oct 3, 2013 at 4:28 PM, Stan  >wrote:
>
>> Hi,
>>
>> I am working on a small app providing Ajax search for a 
>> ModelChoiceFieldLike in addition to an admin-like related lookup (pop up to 
>> changelist). Is it possible for me to embed the magnifier image from admin 
>> statics ? (static/admin/img/selector-search.gif)
>>
>> Thanks.
>>
>> Stanislas.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com .
>> To post to this group, send email to 
>> django-d...@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/2d566ef5-c4a2-4801-ac42-da77506b7603%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/1c2a6d9c-9439-4e3b-80af-99dcce1324a2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Working towards a simpler GCBV implementation?

2013-10-03 Thread Tom Christie
Hi folks,

I recently released an alternative implementation of Django's existing 
class based views.  The intention was to mirror the *exact* same set of 
functionality that we currently provide, but simplify the implementation 
and API.  It's nothing cleverer or grander than a clean re-write, but the 
end result is *significantly* less complex.  The class hierarchy is 
trivial, the API is much smaller, and the flow control is much more obvious.

I won't go into any more here, as there's plenty of detail in the 
documentation:

http://django-vanilla-views.org

There's also useful context in the related blog post, here:

http://dabapps.com/blog/fixing-djangos-generic-class-based-views/

The difficult thing here really is that there's no obvious approach to 
introducing something like this in a backwards compatible way.

It might be that we could take an incremental approach using the standard 
deprecation process, but given the nature of the GCBVs it'd likely be 
pretty awkward.
There might be some bits of deprecation process we simply wouldn't be able 
to deal with in any sensible way, and we'd certainly end up with a 
seriously gnarly implementation during the deprecation period.

I'd be interested in getting some opinions from folks on the following:

* If a simpler GCBV implementation along the lines of django-vanilla-views 
is something we think we should working towards.
* What approaches we might be able to take to dealing with backwards 
compatibility if we did want to do so.

Thanks for your time.

  Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/fe19ddbc-a4d4-4dc0-a241-df45f6e73c96%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Permission to use some Django material ?

2013-10-03 Thread Russell Keith-Magee
Hi Stanislas,

Django is licensed under the terms of the BSD license. This means you can
use any of Django's source code -- including images -- for whatever
purpose, commercial or otherwise, as long as whatever you use is suitably
attributed, and you don't make any claims that what you've done is endorsed
by Django or it's contributors.

The license text itself is quite easy to read:

https://github.com/django/django/blob/master/LICENSE

Yours,
Russ Magee %-)


On Thu, Oct 3, 2013 at 4:28 PM, Stan  wrote:

> Hi,
>
> I am working on a small app providing Ajax search for a
> ModelChoiceFieldLike in addition to an admin-like related lookup (pop up to
> changelist). Is it possible for me to embed the magnifier image from admin
> statics ? (static/admin/img/selector-search.gif)
>
> Thanks.
>
> Stanislas.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" 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/2d566ef5-c4a2-4801-ac42-da77506b7603%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/CAJxq84__f6Qsmyst9yZsuoGctEocWm3HE2eoy%3DMB%2BGT8_k3%3Dqg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Permission to use some Django material ?

2013-10-03 Thread Stan
Hi,

I am working on a small app providing Ajax search for a 
ModelChoiceFieldLike in addition to an admin-like related lookup (pop up to 
changelist). Is it possible for me to embed the magnifier image from admin 
statics ? (static/admin/img/selector-search.gif)

Thanks.

Stanislas.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/2d566ef5-c4a2-4801-ac42-da77506b7603%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Idea about authentication

2013-10-03 Thread Ram Rachum
Hi everybody,

I've submitted the patch, and corrected it, and it's been sitting on the
issue tracker for 2 weeks without anyone commenting. Does anyone care to
discuss this? I want to have this merged in, or discuss any problems in
merging it in.


On Sun, Sep 15, 2013 at 11:27 PM, Ram Rachum  wrote:

> Submitted patch:
>
> https://code.djangoproject.com/ticket/21105#comment:1
>
> On Sunday, September 15, 2013 10:09:55 PM UTC+3, Donald Stufft wrote:
>
>>
>> On Sep 15, 2013, at 2:59 PM, Florian Apolloner 
>> wrote:
>>
>> Hi Ram,
>>
>> On Sunday, September 15, 2013 12:34:03 PM UTC+2, Ram Rachum wrote:
>>>
>>> Florian, I'm not sure that you read my message carefully enough. I'm *not
>>> *proposing to reduce the time that PBKDF2  takes to hash.
>>>
>>
>> By replacing the password with a hash before running it through PBKDF2
>> you are reducing that time for every password longer than the hash… And
>> given the way PBKDF2 works you'll reduce it by quite a bit (note that all
>> of this only applies to passwords longer than the hash, so it's probably
>> pretty academical). Either way, we'd at least need a new hasher class since
>> it would be backwards incompatible. Independent of that we'd have to
>> evaluate if pre-hashing the password could make  PBKDF2 less secure
>> (probably not to likely, but who knows).
>>
>>
>> According to Thomas Porin in the context of bcrypt pre-hashing the
>> password is fine (and we already do this in Django 1.6). I see no reason
>> the same wouldn't hold true for PBKDF2.
>>
>> -
>> Donald Stufft
>> PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372
>> DCFA
>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-developers/iuSE5Y4R3hg/unsubscribe
> .
> To unsubscribe from this group and all its topics, 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/CANXboVazQU4bF_vBtD4y0vxq54mkcjrR-ZaFknmpuyJrFRHMEw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: A policy on calling super()

2013-10-03 Thread Xavier Ordoquy
Hi,

I'm jumping in the discussion as I've tried - hard - to do something similar in 
the past.
However, I'll second what has been said: mixins should be on the left side.

Is there a reason your code can't be similar to:
#class View(object):
#def __init__(self):
#print "View init"

class SomeMixin(object):
def __init__(self):
super(SomeMixin, self).__init__()
print "SomeMixin init"

class MyView(SomeMixin, View):
def __init__(self):
print "MyVIew init"
super(MyView, self).__init__()

MyView()

The reason why the mixin has to be left to the view isn't obvious in your 
example.
If you need the super for the __init__ it's likely that you'll need it for 
other functions. As opposed to __init__ those functions will not exist in the 
object class. Therefore you'll end up with testing if the super has the 
function or not before accessing it because it'll depend on the mixins order.


Regards,
Xavier.


Le 2 oct. 2013 à 23:56, Glin  a écrit :

> Sorry, I had problems to get to my google account, but finally I'm here :).
> 
> I wrote to the ticket meanwhile, but you probably not in CC, so I paste it 
> here, too:
> 
> Having this example:
> class View(object):
> def __init__(self):
> print "View init"
> #super(View, self).__init__()
> 
> class SomeMixin(object):
> def __init__(self):
> print "SomeMixin init"
> super(SomeMixin, self).__init__()
> 
> class MyView(View, SomeMixin):
> def __init__(self):
> print "MyVIew init"
> super(MyView, self).__init__()
> 
> MyView()
>  
> With the commented line in the View class, the method SomeMixin.__init__ is 
> not called, because mro chain is broken, that's the reason why I filled the 
> ticket.
> Practical use - for exemple in current mixins, there are instance attributes 
> which are not defined in __init__, which is bad, code is harder to read when 
> new attributes pop up on unusual places, every checker like pylint displays 
> warning like:
> W:127,8:ModelFormMixin.form_valid: Attribute 'object' defined outside __init__
>  
> So in ModelFormMixin, there should be __init__ which defines 'object' 
> attribute (self.object = None), which is IMHO more than good practice.
> Also having attribute 'object' in __init__, we could avoid ugly constructions 
> like now (also in views/generic/edit.py):
> elif hasattr(self, 'object') and self.object is not None:
>  
> And that's example in Django itself, I bet there could be lot more in various 
> cases of other developers views/mixins, which are hurt by broken mro chain.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers" 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/fb4b4508-99bf-4156-bbdd-f9ee4a957bbd%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/1EEE9B02-9A6D-4318-8F49-7CF6A9F62481%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.