From 0336db8d4052a319f1d959a33fc847814551e3f8 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 29 Aug 2012 23:55:37 -0400 Subject: [PATCH] command:serve-storage: rename `be serve` -> `be serve-storage`. This will help avoid confusion between be serve-storage and be serve-commands --- libbe/command/serve_commands.py | 4 ++-- libbe/command/{serve.py => serve_storage.py} | 10 +++++++--- libbe/storage/http.py | 10 +++++----- libbe/util/wsgi.py | 3 ++- 4 files changed, 16 insertions(+), 11 deletions(-) rename libbe/command/{serve.py => serve_storage.py} (98%) diff --git a/libbe/command/serve_commands.py b/libbe/command/serve_commands.py index 75d9c7a..d8598e2 100644 --- a/libbe/command/serve_commands.py +++ b/libbe/command/serve_commands.py @@ -144,7 +144,7 @@ class ServerApp (libbe.util.wsgi.WSGI_AppObject, libbe.util.subproc.invoke(self.notify, stdin=message, shell=True) -class Serve_Commands (libbe.util.wsgi.ServerCommand): +class ServeCommands (libbe.util.wsgi.ServerCommand): """Serve commands over HTTP. This allows you to run local `be` commands interfacing with remote @@ -181,7 +181,7 @@ for example:: # alias for libbe.command.base.get_command_class() -Serve_commands = Serve_Commands +Serve_commands = ServeCommands if libbe.TESTING: diff --git a/libbe/command/serve.py b/libbe/command/serve_storage.py similarity index 98% rename from libbe/command/serve.py rename to libbe/command/serve_storage.py index 28a8a81..966c932 100644 --- a/libbe/command/serve.py +++ b/libbe/command/serve_storage.py @@ -278,7 +278,7 @@ class ServerApp (libbe.util.wsgi.WSGI_AppObject, libbe.util.subproc.invoke(self.notify, stdin=message, shell=True) -class Serve (libbe.util.wsgi.ServerCommand): +class ServeStorage (libbe.util.wsgi.ServerCommand): """Serve bug directory storage over HTTP. This allows you to run local `be` commands interfacing with remote @@ -288,7 +288,7 @@ class Serve (libbe.util.wsgi.ServerCommand): :class:`ServerApp`. """ - name = 'serve' + name = 'serve-storage' def _get_app(self, logger, storage, **kwargs): return ServerApp( @@ -298,7 +298,7 @@ class Serve (libbe.util.wsgi.ServerCommand): return """ Example usage:: - $ be serve + $ be serve-storage And in another terminal (or after backgrounding the server):: @@ -314,6 +314,10 @@ for example:: """ +# alias for libbe.command.base.get_command_class() +Serve_storage = ServeStorage + + if libbe.TESTING: class ServerAppTestCase (libbe.util.wsgi.WSGITestCase): def setUp(self): diff --git a/libbe/storage/http.py b/libbe/storage/http.py index 5fe0dfc..b1a213f 100644 --- a/libbe/storage/http.py +++ b/libbe/storage/http.py @@ -21,7 +21,7 @@ implementation. See Also -------- -:mod:`libbe.command.serve` : the associated server +:mod:`libbe.command.serve_storage` : the associated server """ from __future__ import absolute_import @@ -44,7 +44,7 @@ if TESTING == True: import unittest import libbe.bugdir - import libbe.command.serve + import libbe.command.serve_storage import libbe.util.http import libbe.util.wsgi @@ -265,12 +265,12 @@ if TESTING == True: name = 'TestingHTTP' def __init__(self, repo, *args, **kwargs): self._storage_backend = base.VersionedStorage(repo) - app = libbe.command.serve.ServerApp( + app = libbe.command.serve_storage.ServerApp( storage=self._storage_backend) self.app = libbe.util.wsgi.BEExceptionApp(app=app) HTTP.__init__(self, repo='http://localhost:8000/', *args, **kwargs) self.intitialized = False - # duplicated from libbe.command.serve.WSGITestCase + # duplicated from libbe.util.wsgi.WSGITestCase self.default_environ = { 'REQUEST_METHOD': 'GET', # 'POST', 'HEAD' 'REMOTE_ADDR': '192.168.0.123', @@ -292,7 +292,7 @@ if TESTING == True: } def getURL(self, app, path='/', method='GET', data=None, scheme='http', environ={}): - # duplicated from libbe.command.serve.WSGITestCase + # duplicated from libbe.util.wsgi.WSGITestCase env = copy.copy(self.default_environ) env['PATH_INFO'] = path env['REQUEST_METHOD'] = method diff --git a/libbe/util/wsgi.py b/libbe/util/wsgi.py index e649bac..9887830 100644 --- a/libbe/util/wsgi.py +++ b/libbe/util/wsgi.py @@ -4,7 +4,8 @@ See Also -------- -:py:mod:`libbe.command.serve` and :py:mod:`libbe.command.serve_commands`. +:py:mod:`libbe.command.serve_storage` and +:py:mod:`libbe.command.serve_commands`. """ import hashlib -- 2.26.2