fusionbox / django-widgy

A CMS framework for Django built on a heterogenous tree editor.
http://wid.gy
Other
332 stars 52 forks source link

More informative messages for compatibility errors #299

Closed rockymeza closed 9 years ago

rockymeza commented 9 years ago

This is an incremental improvement.

Space for improvement would include something like suggesting where to look to fix the problem. For example, I was imagining an error message like this:

CantGoAnywhereWidget refuses to be put in Bucket. Maybe you should write a valid_child_of method for CantGoAnywhereWidget. To learn more visit the docs on compatibility (http://docs.wid.gy/en/latest/compatibility.html).

But I'm worried that the suggestion might be a misleading in some cases.

gavinwahl commented 9 years ago

I get an error when I try this:

Traceback (most recent call last):
  File "lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
    return self.application(environ, start_response)
  File "lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 206, in __call__
    response = self.get_response(request)
  File "lib/python2.7/site-packages/django/core/handlers/base.py", line 194, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "lib/python2.7/site-packages/django/core/handlers/base.py", line 229, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "lib/python2.7/site-packages/django_extensions/management/technical_response.py", line 5, in null_technical_500_response
    six.reraise(exc_type, exc_value, tb)
  File "lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "lib/python2.7/site-packages/django/db/transaction.py", line 371, in inner
    return func(*args, **kwargs)
  File "lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "lib/python2.7/site-packages/argonauts/views.py", line 97, in dispatch
    return self.render_to_response(e.message_dict, status=409)
  File "lib/python2.7/site-packages/django/core/exceptions.py", line 96, in message_dict
    for field, messages in self.error_dict.items():
AttributeError: 'ChildWasRejected' object has no attribute 'error_dict'
rockymeza commented 9 years ago

What version of Django are you on?

-Rocky Meza 2015年2月19日 上午3:03于 "Gavin Wahl" notifications@github.com写道:

I get an error when I try this:

Traceback (most recent call last): File "lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in call return self.application(environ, start_response) File "lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 206, in call response = self.get_response(request) File "lib/python2.7/site-packages/django/core/handlers/base.py", line 194, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "lib/python2.7/site-packages/django/core/handlers/base.py", line 229, in handle_uncaught_exception return debug.technical_500_response(request, _exc_info) File "lib/python2.7/site-packages/django_extensions/management/technical_response.py", line 5, in null_technical_500_response six.reraise(exc_type, exc_value, tb) File "lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response response = wrapped_callback(request, callback_args, _callback_kwargs) File "lib/python2.7/site-packages/django/db/transaction.py", line 371, in inner return func(_args, _kwargs) File "lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view return self.dispatch(request, _args, _kwargs) File "lib/python2.7/site-packages/argonauts/views.py", line 97, in dispatch return self.render_to_response(e.message_dict, status=409) File "lib/python2.7/site-packages/django/core/exceptions.py", line 96, in message_dict for field, messages in self.error_dict.items(): AttributeError: 'ChildWasRejected' object has no attribute 'error_dict'

— Reply to this email directly or view it on GitHub https://github.com/fusionbox/django-widgy/pull/299#issuecomment-74925488 .

gavinwahl commented 9 years ago

I think error_dict was added in 1.6