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:
4
setup.py
4
setup.py
@@ -1,7 +1,7 @@
|
|||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='EWS',
|
name='WSME',
|
||||||
packages=['ews'],
|
packages=['wsme'],
|
||||||
install_requires=['webob'],
|
install_requires=['webob'],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
from controller import *
|
from controller import *
|
||||||
from wsgiapp import *
|
|
||||||
@@ -9,8 +9,8 @@ def scan_api(controller, path=[]):
|
|||||||
if name.startswith('_'):
|
if name.startswith('_'):
|
||||||
continue
|
continue
|
||||||
a = getattr(controller, name)
|
a = getattr(controller, name)
|
||||||
if hasattr(a, '_ews_definition'):
|
if hasattr(a, '_wsme_definition'):
|
||||||
yield path, a._ews_definition
|
yield path, a._wsme_definition
|
||||||
else:
|
else:
|
||||||
for i in scan_api(a, path + [name]):
|
for i in scan_api(a, path + [name]):
|
||||||
yield i
|
yield i
|
||||||
@@ -32,10 +32,10 @@ class FunctionDefinition(object):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get(cls, func):
|
def get(cls, func):
|
||||||
fd = getattr(func, '_ews_definition', None)
|
fd = getattr(func, '_wsme_definition', None)
|
||||||
if fd is None:
|
if fd is None:
|
||||||
fd = FunctionDefinition(func.__name__)
|
fd = FunctionDefinition(func.__name__)
|
||||||
func._ews_definition = fd
|
func._wsme_definition = fd
|
||||||
return fd
|
return fd
|
||||||
|
|
||||||
|
|
||||||
@@ -88,8 +88,8 @@ class WSRoot(object):
|
|||||||
|
|
||||||
def _handle_request(self, request):
|
def _handle_request(self, request):
|
||||||
protocol = None
|
protocol = None
|
||||||
if 'ewsproto' in request.params:
|
if 'wsmeproto' in request.params:
|
||||||
protocol = self.protocols[request.params['ewsproto']]
|
protocol = self.protocols[request.params['wsmeproto']]
|
||||||
else:
|
else:
|
||||||
for p in self.protocols.values():
|
for p in self.protocols.values():
|
||||||
if p.accept(self, request):
|
if p.accept(self, request):
|
||||||
@@ -3,8 +3,8 @@ import webob
|
|||||||
from webob.dec import wsgify
|
from webob.dec import wsgify
|
||||||
import webtest
|
import webtest
|
||||||
|
|
||||||
from ews import *
|
from wsme import *
|
||||||
from ews.controller import scan_api
|
from wsme.controller import scan_api
|
||||||
|
|
||||||
class DummyProtocol(object):
|
class DummyProtocol(object):
|
||||||
name = 'dummy'
|
name = 'dummy'
|
||||||
@@ -34,7 +34,7 @@ class TestController(unittest.TestCase):
|
|||||||
def getint(self):
|
def getint(self):
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
assert MyWS.getint._ews_definition.return_type == int
|
assert MyWS.getint._wsme_definition.return_type == int
|
||||||
|
|
||||||
def test_validate(self):
|
def test_validate(self):
|
||||||
class MyWS(object):
|
class MyWS(object):
|
||||||
@@ -43,7 +43,7 @@ class TestController(unittest.TestCase):
|
|||||||
def add(self, a, b, c=0):
|
def add(self, a, b, c=0):
|
||||||
return a + b + c
|
return a + b + c
|
||||||
|
|
||||||
args = MyWS.add._ews_definition.arguments
|
args = MyWS.add._wsme_definition.arguments
|
||||||
|
|
||||||
assert args[0].name == 'a'
|
assert args[0].name == 'a'
|
||||||
assert args[0].datatype == int
|
assert args[0].datatype == int
|
||||||
@@ -62,9 +62,9 @@ class TestController(unittest.TestCase):
|
|||||||
|
|
||||||
def test_register_protocol(self):
|
def test_register_protocol(self):
|
||||||
p = DummyProtocol()
|
p = DummyProtocol()
|
||||||
import ews.controller
|
import wsme.controller
|
||||||
ews.controller.register_protocol(p)
|
wsme.controller.register_protocol(p)
|
||||||
assert ews.controller.registered_protocols['dummy'] == p
|
assert wsme.controller.registered_protocols['dummy'] == p
|
||||||
|
|
||||||
r = WSRoot()
|
r = WSRoot()
|
||||||
assert r.protocols['dummy']
|
assert r.protocols['dummy']
|
||||||
@@ -103,7 +103,7 @@ class TestController(unittest.TestCase):
|
|||||||
assert p.lastroot == r
|
assert p.lastroot == r
|
||||||
assert p.hits == 1
|
assert p.hits == 1
|
||||||
|
|
||||||
res = app.get('/?ewsproto=dummy')
|
res = app.get('/?wsmeproto=dummy')
|
||||||
|
|
||||||
assert p.lastreq.path == '/'
|
assert p.lastreq.path == '/'
|
||||||
assert p.lastroot == r
|
assert p.lastroot == r
|
||||||
Reference in New Issue
Block a user