summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorianb <devnull@localhost>2006-01-07 22:14:03 +0000
committerianb <devnull@localhost>2006-01-07 22:14:03 +0000
commit9454b6b75cfee4b6ac8327d39a2a0ff828f508ce (patch)
treec69165879c6153d8e3bd6a4d50ebad7a96659f6c /paste
parente74273a11b048ec1f4c4ed0a6712e15376d15b97 (diff)
downloadpaste-9454b6b75cfee4b6ac8327d39a2a0ff828f508ce.tar.gz
Added a little argument to profile.profile_decorator, to allow conditional profiling; added an entry point for the built-in http server, so you can use egg:Paste#http in paste.deploy files; small doc update; got rid of MANIFEST.in, which I don't believe is actually needed to make a proper package (and might actually hurt, since setuptools handles things itself when MANIFEST.in doesn't exist).
Diffstat (limited to 'paste')
-rw-r--r--paste/debug/profile.py7
-rwxr-xr-xpaste/util/httpserver.py15
2 files changed, 22 insertions, 0 deletions
diff --git a/paste/debug/profile.py b/paste/debug/profile.py
index b112041..6fdc48e 100644
--- a/paste/debug/profile.py
+++ b/paste/debug/profile.py
@@ -124,8 +124,15 @@ def profile_decorator(**options):
log_filename:
The temporary filename to log profiling data to. Default;
``./profile_data.log.tmp``
+ no_profile:
+ If true, then don't actually profile anything. Useful for
+ conditional profiling.
"""
+ if options.get('no_profile'):
+ def decorator(func):
+ return func
+ return decorator
def decorator(func):
def replacement(*args, **kw):
return DecoratedProfile(func, **options)(*args, **kw)
diff --git a/paste/util/httpserver.py b/paste/util/httpserver.py
index 8048873..b317a84 100755
--- a/paste/util/httpserver.py
+++ b/paste/util/httpserver.py
@@ -348,6 +348,21 @@ def serve(application, host=None, port=None, handler=None, ssl_pem=None,
pass
return server
+# For paste.deploy server instantiation (egg:Paste#http)
+# Note: this gets a separate function because it has to expect string
+# arguments (though that's not much of an issue yet, ever?)
+def server_runner(wsgi_app, global_conf, host=None, port=None, ssl_pem=None,
+ server_version=None, protocol_version=None):
+ """
+ A simple HTTP server. Also supports SSL if you give it an
+ ``ssl_pem`` argument.
+ """
+ if port:
+ port = int(port)
+ serve(wsgi_app, host=host, port=port, ssl_pem=ssl_pem,
+ server_version=server_version, protocol_version=protocol_version,
+ start_loop=True)
+
if __name__ == '__main__':
# serve exactly 3 requests and then stop, use an external
# program like wget or curl to submit these 3 requests.