On 17 October 2010 23:29, George Sakkis <george.sak...@gmail.com> wrote:
> On Oct 17, 5:58 pm, Russell Keith-Magee <russ...@keith-magee.com>
> wrote:
>> On Sat, Oct 16, 2010 at 12:45 AM, Russell Keith-Magee
>>
>>
>>
>> <russ...@keith-magee.com> wrote:
>> > On Fri, Oct 15, 2010 at 1:09 AM, Justin Lilly <jus...@justinlilly.com> 
>> > wrote:
>> >> Because you asked, I think this sounds like a great idea.
>>
>> >> When you have decided you like the API for create/update
>> >> views, please send another email to the list, so that we
>> >> know we've hit a stable API to write documentation
>> >> against.
>>
>> > I've finished my review of the create/update and date views. I've also
>> > tweaked aspects of the base, detail and list views following feedback
>> > and suggestions from IRC.
>>
>> > I've also added the placeholder skeleton of some documentation:
>> >  * a reference guide
>> >  * a topic guide, and
>> >  * a migration guide
>>
>> > So - review and document away :-)
>>
>> I've just finished writing the first draft of the reference
>> documentation; and thanks to Andrew Godwin, we also have the bulk of
>> some great topic documentation.
>>
>> Along the way, I've made some API tweaks as a result of some
>> documentation-driven development. These tweaks are mostly internal
>> structural things that won't have a huge effect unless you really get
>> involved with the mixins.
>>
>> I should also be able to port the tutorial before I commit -- which,
>> barring objection, I will do tomorrow night my time (about 24 hours
>> from now). Speak now, etc etc.
>
> It's not very important but it occured to me that we can solve the
> second issue against the selected dispatch method ("If you do
> AuthorDetail(foo=True).as_view(), instead of
> AuthorDetail.as_view(foo=True), you will not get an exception, but
> foo=True will effectively be ignored") by making "as_view" a
> descriptor instead of a classmethod; see patch at 
> http://gist.github.com/631306.
>
> George
>

If you check the history of the previous thread, I proposed a similar
thing ;) but instead of a whole descriptor, you can just subclass the
classmethod decorator:

class classonlymethod(classmethod):
   def __get__(self, instance, owner):
       if instance is not None:
           raise AttributeError("This method is availble only on the
view class.")
       return super(classonlymethod, self).__get__(instance, owner)

# and later:

class View:
   @classonlymethod
   def as_view():
      .....

-- 
Łukasz Rekucki

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

Reply via email to