Skip to content

Commit

Permalink
Merge branch 'release/1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
stepank committed Mar 13, 2012
2 parents f4aee90 + 280b3d4 commit 3faff16
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.rst
@@ -1,3 +1,13 @@
Version 1.1.1
-------------

* fixed pyws crashing if SOAP request body does not match the required schema,
issue #16,
* function arguments are inferred correctly, if they are not specified, issue
#17,
* running doctests returns exit code 1 in the case of failure, issue #18.


Version 1.1
-----------

Expand Down
10 changes: 10 additions & 0 deletions docs/index.rst
Expand Up @@ -96,6 +96,16 @@ Changelog
=========


Version 1.1.1
-------------

* fixed pyws crashing if SOAP request body does not match the required schema,
issue #16,
* function arguments are inferred correctly, if they are not specified, issue
#17,
* running doctests returns exit code 1 in the case of failure, issue #18.


Version 1.1
-----------

Expand Down
2 changes: 1 addition & 1 deletion src/pyws/__init__.py
@@ -1 +1 @@
VERSION = '1.1'
VERSION = '1.1.1'
8 changes: 5 additions & 3 deletions src/pyws/functions/__init__.py
@@ -1,4 +1,5 @@
#noinspection PyUnresolvedReferences
from inspect import getargspec

from pyws.functions.args import DictOf, TypeFactory
from pyws.utils import cached_property

Expand Down Expand Up @@ -106,7 +107,8 @@ def __init__(
>>> a(context=None)
>>> def add(a, b):
... return a + b
... c = a + b
... return c
>>> a = NativeFunctionAdapter(add, name='concat')
>>> a.name
Expand Down Expand Up @@ -153,7 +155,7 @@ def __init__(
self.needs_context = needs_context

# Get argument names from origin
arg_names = [(x, ) for x in self.origin.func_code.co_varnames
arg_names = [(x, ) for x in getargspec(origin)[0]
if not needs_context or x != CONTEXT_ARG_NAME]

# Get argument types
Expand Down
9 changes: 8 additions & 1 deletion src/pyws/protocols/soap/__init__.py
Expand Up @@ -40,7 +40,14 @@ def xml2obj(xml, schema):
result = {}
schema = dict((field.name, field.type) for field in schema.fields)
for child in children:
name = get_element_name(child)[1]
ns, name = get_element_name(child)
if name not in schema:
raise BadRequest(
'XML doesn\'t match the required schema. '
'{%s}%s is unexpected under %s, '
'must be one of: %s' % (
ns, name, xml.tag, ', '.join(schema.iterkeys())
))
obj = xml2obj(child, schema[name])
if name not in result:
result[name] = obj
Expand Down
7 changes: 6 additions & 1 deletion tests/run_doctests.py
Expand Up @@ -12,6 +12,11 @@
]

if __name__ == '__main__':
failed = False
for module in modules:
__import__(module)
doctest.testmod(sys.modules[module])
if doctest.testmod(sys.modules[module])[0]:
failed = True

if failed:
sys.exit(1)

0 comments on commit 3faff16

Please sign in to comment.