Renamed EWS to WSME because ews is already taken on pypi
--HG-- rename : ews/__init__.py => wsme/__init__.py rename : ews/controller.py => wsme/controller.py rename : ews/rest.py => wsme/rest.py rename : ews/restjson.py => wsme/restjson.py rename : ews/restxml.py => wsme/restxml.py rename : ews/soap.py => wsme/soap.py rename : ews/tests/__init__.py => wsme/tests/__init__.py rename : ews/tests/test_controller.py => wsme/tests/test_controller.py
This commit is contained in:
parent
127a245d7e
commit
61e5980636
4
setup.py
4
setup.py
@ -1,7 +1,7 @@
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name='EWS',
|
||||
packages=['ews'],
|
||||
name='WSME',
|
||||
packages=['wsme'],
|
||||
install_requires=['webob'],
|
||||
)
|
||||
|
@ -1,2 +1 @@
|
||||
from controller import *
|
||||
from wsgiapp import *
|
@ -9,8 +9,8 @@ def scan_api(controller, path=[]):
|
||||
if name.startswith('_'):
|
||||
continue
|
||||
a = getattr(controller, name)
|
||||
if hasattr(a, '_ews_definition'):
|
||||
yield path, a._ews_definition
|
||||
if hasattr(a, '_wsme_definition'):
|
||||
yield path, a._wsme_definition
|
||||
else:
|
||||
for i in scan_api(a, path + [name]):
|
||||
yield i
|
||||
@ -32,10 +32,10 @@ class FunctionDefinition(object):
|
||||
|
||||
@classmethod
|
||||
def get(cls, func):
|
||||
fd = getattr(func, '_ews_definition', None)
|
||||
fd = getattr(func, '_wsme_definition', None)
|
||||
if fd is None:
|
||||
fd = FunctionDefinition(func.__name__)
|
||||
func._ews_definition = fd
|
||||
func._wsme_definition = fd
|
||||
return fd
|
||||
|
||||
|
||||
@ -88,8 +88,8 @@ class WSRoot(object):
|
||||
|
||||
def _handle_request(self, request):
|
||||
protocol = None
|
||||
if 'ewsproto' in request.params:
|
||||
protocol = self.protocols[request.params['ewsproto']]
|
||||
if 'wsmeproto' in request.params:
|
||||
protocol = self.protocols[request.params['wsmeproto']]
|
||||
else:
|
||||
for p in self.protocols.values():
|
||||
if p.accept(self, request):
|
@ -3,8 +3,8 @@ import webob
|
||||
from webob.dec import wsgify
|
||||
import webtest
|
||||
|
||||
from ews import *
|
||||
from ews.controller import scan_api
|
||||
from wsme import *
|
||||
from wsme.controller import scan_api
|
||||
|
||||
class DummyProtocol(object):
|
||||
name = 'dummy'
|
||||
@ -34,7 +34,7 @@ class TestController(unittest.TestCase):
|
||||
def getint(self):
|
||||
return 1
|
||||
|
||||
assert MyWS.getint._ews_definition.return_type == int
|
||||
assert MyWS.getint._wsme_definition.return_type == int
|
||||
|
||||
def test_validate(self):
|
||||
class MyWS(object):
|
||||
@ -43,7 +43,7 @@ class TestController(unittest.TestCase):
|
||||
def add(self, a, b, c=0):
|
||||
return a + b + c
|
||||
|
||||
args = MyWS.add._ews_definition.arguments
|
||||
args = MyWS.add._wsme_definition.arguments
|
||||
|
||||
assert args[0].name == 'a'
|
||||
assert args[0].datatype == int
|
||||
@ -62,9 +62,9 @@ class TestController(unittest.TestCase):
|
||||
|
||||
def test_register_protocol(self):
|
||||
p = DummyProtocol()
|
||||
import ews.controller
|
||||
ews.controller.register_protocol(p)
|
||||
assert ews.controller.registered_protocols['dummy'] == p
|
||||
import wsme.controller
|
||||
wsme.controller.register_protocol(p)
|
||||
assert wsme.controller.registered_protocols['dummy'] == p
|
||||
|
||||
r = WSRoot()
|
||||
assert r.protocols['dummy']
|
||||
@ -103,7 +103,7 @@ class TestController(unittest.TestCase):
|
||||
assert p.lastroot == r
|
||||
assert p.hits == 1
|
||||
|
||||
res = app.get('/?ewsproto=dummy')
|
||||
res = app.get('/?wsmeproto=dummy')
|
||||
|
||||
assert p.lastreq.path == '/'
|
||||
assert p.lastroot == r
|
Loading…
x
Reference in New Issue
Block a user