On Thursday, June 10, 2010, Dj Gilcrease <digitalx...@gmail.com> wrote:
> Wouldnt an autofield like http://dpaste.com/hold/205665/ work where
> connection.creation.auto_field_base_type is set to int by default in
> django/db/backends/creation.py but could be overridden by an
> individual backend to be str or unicode or whatever?

That's pretty much how Django-nonrel does it. The problem which
Russell talked about is that some developers seem to do something like

def myview(request, pk):
    try:
        query = MyModel.objects.filter(pk=pk)
    except ValueError:
        # oh no, someone passed a string instead of a number! :(
        ...
    try:
        result = query.get()
    except MyModel.DoesNotExist:
        ...

With the poposed AutoField change the exception could not be raised at
query construction time (the first try: block), but at execution time
(the second try: block), so a more flexible AutoField would break the
code above. Though, maybe the exception would become
ObjectDoesNotExist instead of ValueError, so it wouldn't really break
the code above, but it would behave in a different way because the
first except: clause wouldn't be executed, anymore. Russell, please
correct me if you meant something different.

So, the question (as far as I understand) is whether the code above is
actually used by so many developers that you could justify making
NoSQL support a second-class citizen.

Bye,
Waldemar Kornewald

-- 
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