Commit Graph

18 Commits

Author SHA1 Message Date
Luke Faraone 71a91197fa Enable absolute imports.
See PEP 328[1] for details. This feature was introduced in Python 2.5 and
will become mandatory in Python 3.

[1]: http://www.python.org/dev/peps/pep-0328

(imported from commit 7444eeba8a08d5f91b94c7921848f2274979bd76)
2013-04-23 09:51:17 -07:00
Tim Abbott 5dbe8b4c17 [manual] Authenticate using a user_profile as request.user.
When this is deployed to staging, we need to run

./manage.py logout_all_users --realm=humbughq.com

When this is deployed to prod, we need to run

./manage.py logout_all_users

(imported from commit d6c6ea4b1c347f3d9122742db23c7b67767a7349)
2013-04-02 12:07:08 -04:00
Tim Abbott 97d7d31b68 Rewrite internal_send_message to use check_send_message.
This will automatically fix bugs such as one in which
internal_send_message didn't properly strip() the subject argument
before sending a message.

We change the recipient_type argument to internal_send_message to take
the recipient type name (e.g. 'stream') both to better fit the API and
also because the previous code incorrectly handled huddles.

(imported from commit 78c2596d328f6bb1ce2eaa3eed9a9e48146e3b6a)
2013-03-18 16:15:11 -04:00
Tim Abbott 43e43a4248 Fix HumbugAdminEmailHandler for non-exception logged errors.
Previously, AdminEmailHandler would crash if the record did not
contain any exception information (e.g. because it came from
logging.error()).

(imported from commit 868ec68f3a57eddbb2c851ecf9894e5eddf21e4c)
2013-03-15 14:53:17 -04:00
Tim Abbott d42e8ecb11 Log handlers: Provide the actual error message on errors.
Previously when we logged errors using logging.error() but didn't
throw an exception, we would send these totally useless error
humbugs/emails that look like this:

Error generated by Anonymous user (not logged in)
No stack trace available

This change makes those messages include the actual text passed to
logging.error(), which is substantially more useful.

(imported from commit 76a8220ffe66d19cb0ca8ba9d1b42d5ecc4fd511)
2013-03-15 14:53:16 -04:00
Luke Faraone ff59e28f53 Catch all exceptions when sending a message from AdminHumbugHandler
If the database is down and the Handler crashes, we get an email with an
obnoxiously long subject line and without proper sanitization performed.

By wrapping internal_send_message in a try-except, we eliminate the most
common (read: to date, only) cause of crashes in our Handlers.

(imported from commit fd59e931ad0a4fff574d3cafa47348eacacb858f)
2013-02-05 16:12:48 -05:00
Jessica McKellar 8d1ccad29b Prominently display the user in Django 500 emails.
As a side-effect of customizing the e-mail, this also makes the host
on which the error happened a part of the subject line.

(imported from commit 7d5e9ad108b48fd34528512c5955567119935d4e)
2013-01-17 09:47:10 -05:00
Tim Abbott 1a82741650 Move action functions from models.py to zephyr/lib/actions.py.
(imported from commit 9d577dd53ce7d4c9faf6cc8a56129d684a50811b)
2013-01-11 16:11:03 -05:00
Tim Abbott 2125fad6d6 AdminHumbugHandler: Add SERVER_NAME to displayed fields.
For debugging in case this is ever different from platform.node().  I
think this would happen when using a CNAME, for example.

(imported from commit 47f6c3490712a3ac1c6a16f9146c2ef3ca8fc5e8)
2013-01-02 17:36:36 -05:00
Tim Abbott 5a111f6234 AdminHumbugHandler: Fix subject computation in exception case.
(imported from commit 8205d9ab609fa8bad2471d04ac3e4a0a0edb337d)
2013-01-02 17:36:36 -05:00
Luke Faraone 0aedb5ceb7 Clean up the to-Humbug error output to be more visually appealing.
We now encase the request info in a preformatted block, which ensures we
won't accidentally trigger any formatting while being reasonably
space-efficient.

(imported from commit 7c69a6ff2b2abd9474aae08b5ba608bcb40cec56)
2012-12-19 11:08:24 -05:00
Luke Faraone 1796145df3 Ensure we still are filtering out user data in output to Humbug.
(imported from commit a84b1fb9ebc6a9122583d1af3ce5a335715fa860)
2012-12-19 11:08:24 -05:00
Tim Abbott cba3ad8315 Humbug errors: Only display most useful request fields.
(imported from commit 1d7803b5cd1fb099cecbd14af42e2c48d263bdae)
2012-12-11 16:06:12 -05:00
Tim Abbott 1575c522e1 Humbug errors: Adjust the subject to show server name.
(imported from commit 398f0988e7817212a455c73e811be2238695de83)
2012-12-11 16:06:12 -05:00
Tim Abbott 25d95e25c8 Humbug errors: Remove unnecessary newlines in tracebacks.
(imported from commit ad5834fa32e13ede1c634e4e9e535d84eb833c95)
2012-12-11 16:06:12 -05:00
Luke Faraone ced8062509 Use MAX_SUBJECT_LENGTH instead of hardcoded constant.
(imported from commit cc885f7ca196ec1de0279a6a6192044ff7c8420f)
2012-12-07 17:32:16 -05:00
Luke Faraone 7fbee21584 Factor out Message() creation for internal use into separate function.
(imported from commit 0352010da4255fc74cd67835e04dbdb1f8bbf4e9)
2012-12-07 17:32:15 -05:00
Luke Faraone a604183c5b Log errors to Humbug, too.
(imported from commit 2547625135568f3ea004bf4287471a82bc0a4f38)
2012-12-07 17:32:15 -05:00