Commit Graph

552 Commits

Author SHA1 Message Date
Ben Darnell ca8002fa9f Send all logging to the root logger instead of per-module loggers.
This undoes the effect of
e391fd289e

Per-module loggers are problematic because only the top-level convenience
logging.{error,warning,...} functions configure logging on-demand, so
an app that only uses per-module loggers will produce no output except
"no handlers found for logger X".  Since tornado.ioloop swallows and logs
all exceptions, this makes it too hard to tell what's going on for apps
that do not configure logging explicitly.

Instead of setting log levels on individual module's loggers,
logging.Handler.addFilter can be used with a filter that examines
the module attribute of the log record.
2010-04-20 15:40:33 -07:00
Ben Darnell 40ac8d362a Fix header parsing in httpclient for headers whose value contains ':' 2010-04-19 17:07:20 -07:00
Ben Darnell b8a2824343 Better HTTP header parsing: Allow (and strip) any amount of leading
and trailing whitespace around header values instead of just a single
space.  Such whitespace is legal but appears to be uncommon (and nginx
apparently normalizes everything to a single space)
http://tools.ietf.org/html/rfc2616#page-31
2010-04-19 11:20:03 -07:00
Ben Darnell 43e02a2d88 Add a closed flag to AsyncHTTPClient so that a scheduled perform callback
won't cause an exception after the client is closed.
2010-04-19 11:03:06 -07:00
Ben Darnell fc00b61751 Use the original request's protocol as the openid realm instead of hard-coding
http.
2010-04-12 16:06:39 -07:00
Ben Darnell 62bc2e40fd Add support for reading translation from gettext .mo files instead of CSV.
Based on http://github.com/wmark/anzu/commits/gettext
2010-04-07 16:54:34 -07:00
Ben Darnell 002ba2c180 Log a warning when multiple handlers have the same name. 2010-04-05 14:21:16 -07:00
Ben Darnell b5365d8c01 Make options.__getattr__ raise AttributeError instead of Error for consistency
with standard attribute lookups (so getattr(options, 'foo', None) works
if no option 'foo' has been defined).
2010-04-05 12:23:24 -07:00
Ben Darnell 218dd1edc8 Escape double quotes in addition to angle brackets and ampersands. 2010-04-02 11:47:39 -07:00
Elias Torres e520b21ed2 Adding for the ability of ui-modules to add something at the end of the body of a document. 2010-04-02 11:40:56 -07:00
Ben Darnell 794685b892 Merge remote branch 'mgenti/master' 2010-04-02 11:32:18 -07:00
Ben Darnell 5f4413bec4 Return a write method from start_response, as required by the wsgi spec. 2010-03-31 15:37:29 -07:00
unknown c33709a0ec When using the select based IOLoop, select can throw an error if based to many socket. This does not have an errno 2010-03-30 08:40:17 -05:00
Ben Darnell 32a31f4e8e Don't try to colorize log output on terminals that don't support it 2010-03-27 10:30:46 -07:00
Ben Darnell a4ba918180 Make add_handlers (for multiple hostnames) usable with static_path (which
forces the creation of a wildcard handler) by maintaining a sensible order
for handler groups.
2010-03-26 15:55:04 -07:00
Ben Darnell 6326f82715 Add a warning about the experimental status of our win32 support 2010-03-25 16:09:37 -07:00
Ben Darnell 7b458119c4 Be consistent in platform checks: use os.name == 'nt' everywhere, replacing
uses of os.name == 'posix' and sys.platform.startswith('win')
2010-03-25 16:00:09 -07:00
Ben Darnell 064cc4693d Make ioloop test runnable on unix (chmod +x and add #! line), and remove
hard-coded PYTHONPATH manipulations.  Add a small readme for tests.
2010-03-25 15:59:18 -07:00
unknown 3e1d57b2bd Fix for raising an exception;
Fix for waking loop;
Added test
2010-03-24 10:14:03 -05:00
unknown 73fbe2843d Merge branch 'master' of git://github.com/facebook/tornado 2010-03-24 08:25:23 -05:00
Brandon Bickford e391fd289e Use per-module loggers instead of the root logger. 2010-03-23 17:53:20 -07:00
Ben Darnell e340491473 Add __slots__ to ioloop._Timeout to reduce memory overhead when there are
many pending timeouts.
2010-03-23 17:31:14 -07:00
unknown 9f4c6af84a Implementing suggested changes 2010-03-23 09:29:46 -05:00
unknown ae7f90bf5b Merge remote branch 'upstream/master' 2010-03-23 09:24:34 -05:00
Ben Darnell 33a587b0d5 Don't put wsgi response headers in a dictionary to support repeated
headers with the same value (mainly important for Set-Cookie)
2010-03-22 16:35:05 -07:00
Ben Darnell 7fda8c5d38 Don't set the etag header if the handler already did it. 2010-03-20 12:20:42 -07:00
Ben Darnell bce36a7c1a Add a callback to handle headers in httpclient as they come in, so
they will be available for data handled by streaming_callback.
2010-03-19 11:20:56 -07:00
Ben Darnell 70fb42d6a0 Add a close method to AsyncHTTPClient. 2010-03-18 13:27:49 -07:00
Dolapo Falola 03308b1a7d add a template_loader application setting for using custom template loaders. a slight refactoring of TemplateLoader's load method to expose some internals. also, add a reset method to the loader that's called in debug mode to flush the template cache. 2010-03-17 19:22:33 -07:00
Ben Darnell 8359c05ca0 Support named groups in url pattern regexes. Note that either all or none
of the groups to be passed to the handler must be named.
2010-03-17 18:51:37 -07:00
Ben Darnell fca7c83134 Allow more than two consecutive curlies to appear in templates (and use
the innermost).  This was previously a syntax error in the generated python.
2010-03-17 18:48:32 -07:00
Ben Darnell 8c096b231c Combine repeated headers with the same name into a single comma-separated string
http://www.w3.org/Protocols/HTTP/1.0/spec.html#Message-Headers
2010-03-17 18:29:03 -07:00
Ben Darnell 40ce72c1c6 Replace all tabs with spaces. 2010-03-17 14:59:17 -07:00
Fabricio Zuardi 6d070f77c2 updated the gitignore to include files generated on installation 2010-03-14 00:08:26 -03:00
unknown 6704dc99a0 win32 needs to open the files as binary 2010-03-10 15:40:36 -06:00
unknown bec0552eff Trying to better re-use code 2010-03-10 15:39:50 -06:00
unknown 248c57809f Merge remote branch 'upstream/master' 2010-03-10 15:37:58 -06:00
Ben Darnell d2ca9ad618 Fix bug with IOLoop's 'waker' pipe which rendered it ineffective on linux
and mac (where pipes are unidirectional) and caused high cpu usage
on solaris (where pipes are bidirectional).  Thanks to Jari Ahonen for
finding the bug.
2010-03-09 09:17:23 -08:00
Ben Darnell 45f76c518e In finish(), test if chunk is None rather than using truthiness to decide
whether to call write().

This fixes a discrepancy between finish() and write() when outputting json.
Now both write({}) and finish({}) will output an empty json object.
2010-03-07 12:47:52 -08:00
Ben Darnell 8637a738ef Set the close-on-exec flag on file descriptors used by IOLoop (epoll/kqueue
and pipe) so that long-lived autoreloading processes don't leak file
descriptors.
2010-03-04 12:39:33 -08:00
Ben Darnell f4359bc128 Use a WeakKeyDictionary instead of a regular dictionary to associate
IOLoop and AsyncHTTPClients.  This prevents leaks of memory and file
descriptors when one process (in my case a unit test runner) create
many IOLoop/AsyncHTTPClient pairs.
2010-03-04 11:52:18 -08:00
Ben Darnell d42334e319 Allow subclasses of IOLoop to override the default logging of
uncaught exceptions in callbacks.
2010-03-03 19:14:45 -08:00
Ben Darnell a0af68cc04 Ensure that self.io_loop is set in HTTPServer.start(), so that HTTPServer.stop
can clean up correctly.
2010-03-03 17:22:48 -08:00
Ben Darnell 62cdb36b6c Revamp logging configuration.
* If --logging=none, tornado will not touch the python logging config.
* Colored output is optional.  If curses is not available or stderr is not
  a tty, non-colorized output will be used.
* Log output to stderr can be suppressed with --log_to_stderr=false
* Logs can be written to a file (non-colorized) with --log_file_prefix.
  Logs will be rotated, which can be controlled with --log_file_max_size
  and --log_file_num_backups.
* By default, logs go to a file if --log_file_prefix is set and to stderr
  if it is not.  To log to both stderr and a file, --log_to_stderr must
  be set to true explicitly.
2010-03-01 19:18:04 -08:00
Ben Darnell 61f0fafe4b Call the close() method on the wsgi response object if it exists.
This is required by the WSGI spec, and cherrypy leaks memory without it.
2010-02-26 16:36:21 -08:00
Ben Darnell f6266ba806 Add SERVER_PROTOCOL variable to wsgi environment. This turns out to be
necessary for using cherrypy in a tornado WSGIContainer.
2010-02-26 14:08:09 -08:00
Ben Weaver 1ae186a504 Add exc_info parameter to start_response() in WSGIContainer. 2010-02-26 13:11:27 -05:00
Ben Darnell c5627d2f16 Work around an odd error I occasionally see in autoreload (which causes
autoreload to loop endlessly without restarting the process)
2010-02-25 15:49:08 -08:00
Ben Darnell f9cda8634b Add a workaround for a bug in os.execv when used on Mac OS X versions
prior to 10.6 when there are multiple threads in the process.
2010-02-24 16:37:11 -08:00
Ben Darnell 010271d7ec Always reraise KeyboardInterrupt and SystemExit whenever IOLoop tries to
swallow exceptions.
2010-02-24 15:18:39 -08:00