Hello community, here is the log from the commit of package python-WSME for openSUSE:Factory checked in at 2014-09-15 17:41:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-WSME (Old) and /work/SRC/openSUSE:Factory/.python-WSME.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-WSME" Changes: -------- --- /work/SRC/openSUSE:Factory/python-WSME/python-WSME.changes 2014-02-26 06:55:11.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-WSME.new/python-WSME.changes 2014-09-15 18:25:09.000000000 +0200 @@ -1,0 +2,14 @@ +Mon Sep 15 04:56:46 UTC 2014 - [email protected] + +- Update to version 0.6.1: + * one more update for 0.6.1 change list + * Fix error: variable 'kw' referenced before assignment + * Fix pep8 errors + * Update change list for 0.6.1 release + * Fix default handling for zero values + * Fixing spelling mistakes + * A proper check of UuidType + * pecan: cleanup, use global vars and staticmethod + * args_from_args() to work with an instance of UserType + +------------------------------------------------------------------- Old: ---- WSME-0.6.tar.gz New: ---- WSME-0.6.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-WSME.spec ++++++ --- /var/tmp/diff_new_pack.SLjumA/_old 2014-09-15 18:25:10.000000000 +0200 +++ /var/tmp/diff_new_pack.SLjumA/_new 2014-09-15 18:25:10.000000000 +0200 @@ -17,7 +17,7 @@ Name: python-WSME -Version: 0.6 +Version: 0.6.1 Release: 0 Summary: Web Services Made Easy License: MIT ++++++ WSME-0.6.tar.gz -> WSME-0.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/ChangeLog new/WSME-0.6.1/ChangeLog --- old/WSME-0.6/ChangeLog 2014-02-06 15:49:32.000000000 +0100 +++ new/WSME-0.6.1/ChangeLog 2014-05-02 15:27:16.000000000 +0200 @@ -1,6 +1,19 @@ CHANGES ======= +0.6.1 +----- + +* one more update for 0.6.1 change list +* Fix error: variable 'kw' referenced before assignment +* Fix pep8 errors +* Update change list for 0.6.1 release +* Fix default handling for zero values +* Fixing spelling mistakes +* A proper check of UuidType +* pecan: cleanup, use global vars and staticmethod +* args_from_args() to work with an instance of UserType + 0.6 --- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/PKG-INFO new/WSME-0.6.1/PKG-INFO --- old/WSME-0.6/PKG-INFO 2014-02-06 15:49:32.000000000 +0100 +++ new/WSME-0.6.1/PKG-INFO 2014-05-02 15:27:16.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: WSME -Version: 0.6 +Version: 0.6.1 Summary: Simplify the writing of REST APIs, and extend them with additional protocols. Home-page: UNKNOWN Author: "Christophe de Vienne" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/WSME.egg-info/PKG-INFO new/WSME-0.6.1/WSME.egg-info/PKG-INFO --- old/WSME-0.6/WSME.egg-info/PKG-INFO 2014-02-06 15:49:32.000000000 +0100 +++ new/WSME-0.6.1/WSME.egg-info/PKG-INFO 2014-05-02 15:27:16.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: WSME -Version: 0.6 +Version: 0.6.1 Summary: Simplify the writing of REST APIs, and extend them with additional protocols. Home-page: UNKNOWN Author: "Christophe de Vienne" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/WSME.egg-info/SOURCES.txt new/WSME-0.6.1/WSME.egg-info/SOURCES.txt --- old/WSME-0.6/WSME.egg-info/SOURCES.txt 2014-02-06 15:49:32.000000000 +0100 +++ new/WSME-0.6.1/WSME.egg-info/SOURCES.txt 2014-05-02 15:27:16.000000000 +0200 @@ -54,6 +54,7 @@ tests/pecantest/test/tests/__init__.py tests/pecantest/test/tests/config.py tests/pecantest/test/tests/test_ws.py +tests/rest/test_args.py tests/sphinxexample/conf.py tests/sphinxexample/document.rst tests/sphinxexample/index.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/doc/changes.rst new/WSME-0.6.1/doc/changes.rst --- old/WSME-0.6/doc/changes.rst 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/doc/changes.rst 2014-05-02 15:27:08.000000000 +0200 @@ -1,6 +1,30 @@ Changes ======= +0.6.1 +----- + +* Fix error: variable 'kw' referenced before assignment +* Fix default handling for zero values +* Fixing spelling mistakes +* A proper check of UuidType +* pecan: cleanup, use global vars and staticmethod +* args_from_args() to work with an instance of UserType + +0.6 +--- + +* Add 'readonly' parameter to wsattr +* Fix typos in documents and comments +* Support dynamic types +* Support building wheels (PEP-427) +* Fix a typo in the types documentation +* Add IntegerType and some classes for validation +* Use assertRaises() for negative tests +* Remove the duplicated error message from Enum +* Drop description from 403 flask test case +* Fix SyntaxWarning under Python 3 + 0.5b6 (2013-10-16) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/doc/types.rst new/WSME-0.6.1/doc/types.rst --- old/WSME-0.6/doc/types.rst 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/doc/types.rst 2014-05-02 15:27:07.000000000 +0200 @@ -59,8 +59,8 @@ def getlist(self): return ['a', 'b', 'c'] - - Dictionnaries -- Statically typed mapping are allowed. When exposing - a dictionnary datatype, you can specify the key and value types, + - Dictionaries -- Statically typed mapping are allowed. When exposing + a dictionary datatype, you can specify the key and value types, with a restriction on the key value that must be a 'pod' type. Example:: @@ -80,7 +80,7 @@ or needs to validate data integrity. To define a user type, you just have to inherit from -:class:`wsme.types.UserType` and instanciate your new class. This instance +:class:`wsme.types.UserType` and instantiate your new class. This instance will be your new type and can be used as @\ :class:`wsme.expose` or @\ :class:`wsme.validate` parameters. @@ -171,7 +171,7 @@ - The class must have a default constructor -- Since instances of the type will be created by the protocols when - used as input types, they must be instanciable without any argument. + used as input types, they must be instantiable without any argument. - Complex types are registered automatically (and thus inspected) as soon a they are used in expose or validate, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/tests/rest/test_args.py new/WSME-0.6.1/tests/rest/test_args.py --- old/WSME-0.6/tests/rest/test_args.py 1970-01-01 01:00:00.000000000 +0100 +++ new/WSME-0.6.1/tests/rest/test_args.py 2014-05-02 15:27:07.000000000 +0200 @@ -0,0 +1,20 @@ +import mock +import unittest + +from wsme import exc +from wsme.rest import args +from wsme.rest import json + + +class TestArgs(unittest.TestCase): + + def test_args_from_body(self): + + funcdef = mock.MagicMock() + body = mock.MagicMock() + mimetype = "application/json" + funcdef.ignore_extra_args = True + json.parse = mock.MagicMock() + json.parse.side_effect = (exc.UnknownArgument("")) + resp = args.args_from_body(funcdef, body, mimetype) + self.assertEqual(resp, ((), {})) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsme/rest/args.py new/WSME-0.6.1/wsme/rest/args.py --- old/WSME-0.6/wsme/rest/args.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsme/rest/args.py 2014-05-02 15:27:07.000000000 +0200 @@ -18,7 +18,7 @@ @generic def from_param(datatype, value): - return datatype(value) if value else None + return datatype(value) if value is not None else None @from_param.when_object(datetime.date) @@ -171,10 +171,14 @@ try: newargs.append(from_param(argdef.datatype, arg)) except Exception: + if isinstance(argdef.datatype, UserType): + datatype_name = argdef.datatype.name + else: + datatype_name = argdef.datatype.__name__ raise InvalidInput( argdef.name, arg, - "unable to convert to %s" % argdef.datatype.__name__) + "unable to convert to %s" % datatype_name) newkwargs = {} for argname, value in kwargs.items(): newkwargs[argname] = from_param( @@ -228,6 +232,7 @@ except UnknownArgument: if not funcdef.ignore_extra_args: raise + kw = {} return (), kw diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsme/rest/json.py new/WSME-0.6.1/wsme/rest/json.py --- old/WSME-0.6/wsme/rest/json.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsme/rest/json.py 2014-05-02 15:27:07.000000000 +0200 @@ -262,8 +262,6 @@ def encode_sample_result(datatype, value, format=False): r = tojson(datatype, value) - #if self.nest_result: - #r = {'result': r} content = json.dumps(r, ensure_ascii=False, indent=4 if format else 0, sort_keys=format) return ('javascript', content) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsme/tests/test_protocols_commons.py new/WSME-0.6.1/wsme/tests/test_protocols_commons.py --- old/WSME-0.6/wsme/tests/test_protocols_commons.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsme/tests/test_protocols_commons.py 2014-05-02 15:27:07.000000000 +0200 @@ -3,7 +3,9 @@ import datetime import unittest -from wsme.rest.args import from_param, from_params +from wsme.api import FunctionArgument, FunctionDefinition +from wsme.rest.args import from_param, from_params, args_from_args +from wsme.exc import InvalidInput from wsme.types import UserType, Unset, ArrayType, DictType @@ -52,3 +54,53 @@ def test_from_params_dict_unset(self): assert from_params(DictType(int, str), {}, 'a', set()) is Unset + + def test_args_from_args_usertype(self): + + class FakeType(UserType): + name = 'fake-type' + basetype = int + + fake_type = FakeType() + fd = FunctionDefinition(FunctionDefinition) + fd.arguments.append(FunctionArgument('fake-arg', fake_type, True, 0)) + + new_args = args_from_args(fd, [1], {}) + self.assertEqual([1], new_args[0]) + + # can't convert str to int + try: + args_from_args(fd, ['invalid-argument'], {}) + except InvalidInput as e: + assert fake_type.name in str(e) + else: + self.fail('Should have thrown an InvalidInput') + + +class ArgTypeConversion(unittest.TestCase): + + def test_int_zero(self): + self.assertEqual(0, from_param(int, 0)) + self.assertEqual(0, from_param(int, '0')) + + def test_int_nonzero(self): + self.assertEqual(1, from_param(int, 1)) + self.assertEqual(1, from_param(int, '1')) + + def test_int_none(self): + self.assertEqual(None, from_param(int, None)) + + def test_float_zero(self): + self.assertEqual(0.0, from_param(float, 0)) + self.assertEqual(0.0, from_param(float, 0.0)) + self.assertEqual(0.0, from_param(float, '0')) + self.assertEqual(0.0, from_param(float, '0.0')) + + def test_float_nonzero(self): + self.assertEqual(1.0, from_param(float, 1)) + self.assertEqual(1.0, from_param(float, 1.0)) + self.assertEqual(1.0, from_param(float, '1')) + self.assertEqual(1.0, from_param(float, '1.0')) + + def test_float_none(self): + self.assertEqual(None, from_param(float, None)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsme/tests/test_restjson.py new/WSME-0.6.1/wsme/tests/test_restjson.py --- old/WSME-0.6/wsme/tests/test_restjson.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsme/tests/test_restjson.py 2014-05-02 15:27:07.000000000 +0200 @@ -330,14 +330,6 @@ ) assert r[0] == 'javascript', r[0] assert r[1] == '''2''' - #self.root.protocols[0].nest_result = True - #r = wsme.rest.json.encode_sample_result( - #int, 2, True - #) - #assert r[0] == 'javascript', r[0] - #assert r[1] == '''{ - #"result": 2 -#}''' def test_PUT(self): data = {"id": 1, "name": u("test")} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsme/tests/test_types.py new/WSME-0.6.1/wsme/tests/test_types.py --- old/WSME-0.6/wsme/tests/test_types.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsme/tests/test_types.py 2014-05-02 15:27:07.000000000 +0200 @@ -345,8 +345,10 @@ def test_validate_uuid_type(self): v = types.UuidType() - v.validate('6a0a707c-45ef-4758-b533-e55adddba8ce') - v.validate('6a0a707c45ef4758b533e55adddba8ce') + self.assertEqual(v.validate('6a0a707c-45ef-4758-b533-e55adddba8ce'), + '6a0a707c-45ef-4758-b533-e55adddba8ce') + self.assertEqual(v.validate('6a0a707c45ef4758b533e55adddba8ce'), + '6a0a707c-45ef-4758-b533-e55adddba8ce') self.assertRaises(ValueError, v.validate, '') self.assertRaises(ValueError, v.validate, 'foo') self.assertRaises(ValueError, v.validate, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsme/types.py new/WSME-0.6.1/wsme/types.py --- old/WSME-0.6/wsme/types.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsme/types.py 2014-05-02 15:27:07.000000000 +0200 @@ -69,7 +69,7 @@ class DictType(object): def __init__(self, key_type, value_type): if key_type not in pod_types: - raise ValueError("Dictionnaries key can only be a pod type") + raise ValueError("Dictionaries key can only be a pod type") self.key_type = key_type if iscomplex(value_type): self._value_type = weakref.ref(value_type) @@ -270,7 +270,7 @@ @staticmethod def validate(value): try: - uuid.UUID(value) + return six.text_type((uuid.UUID(value))) except (TypeError, ValueError, AttributeError): error = 'Value should be UUID format' raise ValueError(error) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsmeext/pecan.py new/WSME-0.6.1/wsmeext/pecan.py --- old/WSME-0.6/wsmeext/pecan.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsmeext/pecan.py 2014-05-02 15:27:07.000000000 +0200 @@ -15,10 +15,12 @@ class JSonRenderer(object): - def __init__(self, path, extra_vars): + @staticmethod + def __init__(path, extra_vars): pass - def render(self, template_path, namespace): + @staticmethod + def render(template_path, namespace): if 'faultcode' in namespace: return wsme.rest.json.encode_error(None, namespace) return wsme.rest.json.encode_result( @@ -28,10 +30,12 @@ class XMLRenderer(object): - def __init__(self, path, extra_vars): + @staticmethod + def __init__(path, extra_vars): pass - def render(self, template_path, namespace): + @staticmethod + def render(template_path, namespace): if 'faultcode' in namespace: return wsme.rest.xml.encode_error(None, namespace) return wsme.rest.xml.encode_result( @@ -42,22 +46,23 @@ pecan.templating._builtin_renderers['wsmejson'] = JSonRenderer pecan.templating._builtin_renderers['wsmexml'] = XMLRenderer +pecan_json_decorate = pecan.expose( + template='wsmejson:', + content_type='application/json', + generic=False) +pecan_xml_decorate = pecan.expose( + template='wsmexml:', + content_type='application/xml', + generic=False +) +pecan_text_xml_decorate = pecan.expose( + template='wsmexml:', + content_type='text/xml', + generic=False +) + def wsexpose(*args, **kwargs): - pecan_json_decorate = pecan.expose( - template='wsmejson:', - content_type='application/json', - generic=False) - pecan_xml_decorate = pecan.expose( - template='wsmexml:', - content_type='application/xml', - generic=False - ) - pecan_text_xml_decorate = pecan.expose( - template='wsmexml:', - content_type='text/xml', - generic=False - ) sig = wsme.signature(*args, **kwargs) def decorate(f): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsmeext/soap/protocol.py new/WSME-0.6.1/wsmeext/soap/protocol.py --- old/WSME-0.6/wsmeext/soap/protocol.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsmeext/soap/protocol.py 2014-05-02 15:27:07.000000000 +0200 @@ -56,7 +56,6 @@ int: 'xs:int', float: "xs:float", bool: "xs:boolean", - #unsigned: "xs:unsignedInt", datetime.datetime: "xs:dateTime", datetime.date: "xs:date", datetime.time: "xs:time", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsmeext/sqlalchemy/types.py new/WSME-0.6.1/wsmeext/sqlalchemy/types.py --- old/WSME-0.6/wsmeext/sqlalchemy/types.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsmeext/sqlalchemy/types.py 2014-05-02 15:27:07.000000000 +0200 @@ -125,9 +125,9 @@ for attr in self._wsme_attributes: if not isinstance(attr, wsattr): continue - if attrs and not attr.isrelation and not attr.name in attrs: + if attrs and not attr.isrelation and attr.name not in attrs: continue - if attr.isrelation and not attr.name in eagerload: + if attr.isrelation and attr.name not in eagerload: continue value = getattr(instance, attr.saname) if attr.isrelation: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WSME-0.6/wsmeext/tests/test_soap.py new/WSME-0.6.1/wsmeext/tests/test_soap.py --- old/WSME-0.6/wsmeext/tests/test_soap.py 2014-02-06 15:49:22.000000000 +0100 +++ new/WSME-0.6.1/wsmeext/tests/test_soap.py 2014-05-02 15:27:07.000000000 +0200 @@ -258,7 +258,7 @@ return [fromsuds(dt[0], item) for item in value.item] if wsme.types.isarray(dt): return [fromsuds(dt.item_type, item) for item in value.item] - if wsme.types.isusertype(dt) and not dt in fromsuds_types: + if wsme.types.isusertype(dt) and dt not in fromsuds_types: dt = dt.basetype if dt in fromsuds_types: print(dt, value) @@ -390,12 +390,7 @@ return self._sudsclient def test_wsdl(self): - #assert res.body.find('NestedOuter_Array') != -1 - #assert 'returntypesGettext' in res.body - #assert 'returntypesGettextResponse' in res.body -# c = self.sudsclient - print(c) assert c.wsdl.tns[1] == tns, c.wsdl.tns sd = c.sd[0] -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
