Yelp/Tron — pull request #264 by Codeacious (2013-08-03 00:31:06+00:00)
Title: Fix to configuration loads with %(month[+\-][1-12])s that go out of range

This is a fix to #249. The core of the issue comes from when something with `%(month[+\-][1-12])s` in its command context tries to be loaded on a day of the current month that isn't in the month targeted by the command context. For example, having `%(month-1)s` on the 31st of most months will cause an attempted creation of a `datetime` object of `datetime(year, month, 31)` when `month` is something like `06` (June, current month is July).

This fix simply checks if the day was greater than it should have been, and if so, sets it to whatever the last day of the desired month is/was/will be. If this isn't what caused the exception, we raise it again.

We don't have to worry about not raising an exception in a case where the original starting day was invalid, as date deltas are handled differently (it just is a movement of that exact number of days, regardless of month or year), and this issue only happens in the creation of the second datetime object used for delta calculation (so if the original day was invalid, we'll still get an exception).