Re: [Django] #18545: Improve the error message when the implicit settings configuration fails

2012-09-08 Thread Django
#18545: Improve the error message when the implicit settings configuration fails
--+
 Reporter:  ncoghlan  |Owner:  carljm
 Type:  Cleanup/optimization  |   Status:  closed
Component:  Core (Other)  |  Version:  1.4
 Severity:  Normal|   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Carl Meyer ):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [307706d082d20ac868654ccbaee18879db5197db]:
 {{{
 #!CommitTicketReference repository=""
 revision="307706d082d20ac868654ccbaee18879db5197db"
 Fixed #18545 -- Make the 'no DJANGO_SETTINGS_MODULE' error message more
 useful.Thanks Nick Coghlan for the report, and Malcolm Tredinnick for
 review.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #18545: Improve the error message when the implicit settings configuration fails

2012-09-08 Thread Django
#18545: Improve the error message when the implicit settings configuration fails
--+
 Reporter:  ncoghlan  |Owner:  carljm
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  1.4
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by carljm):

 * owner:  nobody => carljm
 * component:  Uncategorized => Core (Other)
 * type:  Uncategorized => Cleanup/optimization


Comment:

 Replying to [comment:2 anonymous]:
 > Russell Keith-Magee and I were able to discuss this briefly at PyConAU.
 For the second part, it may be worth pursuing that as a general
 improvement to LazyObject. The trick is to avoid losing existing debugging
 data in the Python 2 case - in Python 3, it would be possible to just do
 "raise X from Y" when the init call fails to add the extra info about
 which attribute was being looked up without losing the original traceback,
 but in Python 2, raising a new exception means losing the original
 traceback. Perhaps it would be enough to just preserve the original error
 message? Is gaining the attribute name worth losing the inner part of the
 traceback?

 I don't understand the necessity for `raise X from Y` in this case, or any
 of the associated Python 2 difficulty. All that's necessary is for
 `LazySettings` to override `__getattr__` to pass the requested attribute
 name into `_setup`. I have this implemented at
 https://github.com/carljm/django/compare/ticket_18545

 Worth noting this doesn't really help with *incrementally* figuring out
 the settings you need, it only helps with the very first one, since you
 only see this error if you've done nothing at all settings-related. Once
 you've called `settings.configure()`, if there's an additional setting you
 haven't set, you'll get a setting-specific error message from some other
 part of Django (e.g. the ORM will complain if you don't have `DATABASES`,
 the URL-resolver will complain if you have no `ROOT_URLCONF`, etc). But
 it's still marginally useful that initial time, and there's little cost,
 so going ahead and adding it.

 Mentioning `settings.configure()` is of course a great idea, thanks for
 suggesting it.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #18545: Improve the error message when the implicit settings configuration fails

2012-09-06 Thread Django
#18545: Improve the error message when the implicit settings configuration fails
---+
 Reporter:  ncoghlan   |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Uncategorized  |  Version:  1.4
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+

Comment (by anonymous):

 Russell Keith-Magee and I were able to discuss this briefly at PyConAU.
 For the second part, it may be worth pursuing that as a general
 improvement to LazyObject. The trick is to avoid losing existing debugging
 data in the Python 2 case - in Python 3, it would be possible to just do
 "raise X from Y" when the init call fails to add the extra info about
 which attribute was being looked up without losing the original traceback,
 but in Python 2, raising a new exception means losing the original
 traceback. Perhaps it would be enough to just preserve the original error
 message? Is gaining the attribute name worth losing the inner part of the
 traceback?

 The first part should be relatively straightforward, though - that's just
 a matter of mentioning the direct API in the error message.

 (I ended up keeping busy with CPython at the sprints though, so I
 unfortunately never followed it up at the sprints).

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #18545: Improve the error message when the implicit settings configuration fails

2012-07-08 Thread Django
#18545: Improve the error message when the implicit settings configuration fails
---+
 Reporter:  ncoghlan   |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Uncategorized  |  Version:  1.4
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+
Changes (by lukeplant):

 * needs_docs:   => 0
 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * stage:  Unreviewed => Accepted


Comment:

 This is definitely an area we could improve a lot. I don't know exactly
 what the solution should look like, or what solutions are feasible, but
 I'm accepting it on principle.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

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



[Django] #18545: Improve the error message when the implicit settings configuration fails

2012-07-01 Thread Django
#18545: Improve the error message when the implicit settings configuration fails
---+
 Reporter:  ncoghlan   |  Owner:  nobody
 Type:  Uncategorized  | Status:  new
Component:  Uncategorized  |Version:  1.4
 Severity:  Normal |   Keywords:
 Triage Stage:  Unreviewed |  Has patch:  0
Easy pickings:  0  |  UI/UX:  0
---+
 Currently, the fairly generic ImportError message received when the
 implicit settings configuration fails has a couple of problems:
 - it doesn't mention the possibility of using
 django.conf.settings.configure(). The current error message suggests that
 an environment variable pointing to a module is the only configuration
 mechanism Django supports.
 - it doesn't mention *which setting* was being looked up when the implicit
 load failed

 These combine to prevent someone that wants to use Django as a library
 from *incrementally* working out the minimum configuration they need to
 provide. Instead, they just get told "you need to provide some settings,
 but we're not going to give you any hints as to what settings are needed
 for the operations you're trying to use".

 Adjusting the way the lazy initialisation is performed would go a long
 towards making django usable as a library - I could just start importing
 things, see what settings get accessed, look up those individual settings
 and provide appropriate values in a django.conf.settings.configure() call.
 With the current unhelpful error message, I have no idea where to even
 start.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

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