diff --git a/README.md b/README.md index db9af05..2135638 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ Features Requirements ----- -- Python >= 3.4.0 -- Autobahn.ws >= 0.12.1 +- Python >= 3.4.2 +- Autobahn.ws == 0.16.0 Optional: - SQLAlchemy ORM >= 1.0 @@ -54,8 +54,7 @@ Getting started var ws = null; var isopen = false; -window.onload = function() -{ +window.onload = function() { ws = new WebSocket("ws://127.0.0.1:8080"); ws.onopen = function() { console.log("Connected!"); @@ -103,7 +102,7 @@ class HelloClientProtocol(WebSocketClientProtocol): if __name__ == '__main__': - factory = WebSocketClientFactory("ws://localhost:8080", debug=False) + factory = WebSocketClientFactory("ws://localhost:8080") factory.protocol = HelloClientProtocol loop = asyncio.get_event_loop() diff --git a/docs/source/app.rst b/docs/source/app.rst index c6ec952..df2938a 100644 --- a/docs/source/app.rst +++ b/docs/source/app.rst @@ -22,7 +22,6 @@ handler. It can be method-based: from aiorest_ws.views import MethodBasedView class HelloWorld(MethodBasedView): - def get(self, request, *args, **kwargs): return "Hello, world!" diff --git a/docs/source/conf.py b/docs/source/conf.py index 3073fda..00c6167 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -69,7 +69,7 @@ # General information about the project. project = 'aiorest-ws' -copyright = '2015, Valeryi Savich' +copyright = '2016, Valeryi Savich' author = 'Valeryi Savich' # The version info for the project you're documenting, acts as replacement for @@ -77,9 +77,9 @@ # built documents. # # The short X.Y version. -version = '1.0' +version = '1.1' # The full version, including alpha/beta/rc tags. -release = '1.0' +release = '1.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -136,6 +136,7 @@ # further. For a list of options available for each theme, see the # documentation. html_theme_options = { + 'logo': 'logo.png', 'description': 'REST framework with WebSockets support', 'github_user': 'Relrin', @@ -172,7 +173,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ['static', ] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied diff --git a/docs/source/index.rst b/docs/source/index.rst index 0c60b64..2c350b0 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -22,6 +22,7 @@ Features - Authentication (using JSON Web Token) - Customizing behaviour of your application through settings file - Compressing messages for minimize of transmitted traffic (if your browser support) +- Model serializing for Django and SQLAlchemy ORM - SSL support Library installation @@ -43,8 +44,7 @@ Client example (JavaScript): var ws = null; var isopen = false; - window.onload = function() - { + window.onload = function() { ws = new WebSocket("ws://127.0.0.1:8080"); ws.onopen = function() { console.log("Connected!"); @@ -93,7 +93,7 @@ Client example (Python): if __name__ == '__main__': - factory = WebSocketClientFactory("ws://localhost:8080", debug=False) + factory = WebSocketClientFactory("ws://localhost:8080") factory.protocol = HelloClientProtocol loop = asyncio.get_event_loop() @@ -157,15 +157,15 @@ Contents: --------- .. toctree:: - :maxdepth: 2 + :maxdepth: 3 auth app request routing + serializing wrappers views - api Indices and tables ================== diff --git a/docs/source/serializing.rst b/docs/source/serializing.rst new file mode 100644 index 0000000..7ea269c --- /dev/null +++ b/docs/source/serializing.rst @@ -0,0 +1,172 @@ +.. _aiorest-ws-serializing: + +Model serializing +================= + +.. currentmodule:: aiorest_ws.db.orm + +Serializers which will be described below give to a programmer opportunities to convert complex +data structures like model instances of certain ORM to the default Python datatypes. The result +of this processing can be returned to a user in JSON, XML or any other formats. These serializers +also provide deserializing mechanisms which can be used for parsing and validating user input data +that will be used for to work with ORMs further. + +These serializers largely based on ideas of Django REST Framework. In this way a lot of +functionality that will be described further will coincide with this library. + +At the moment aiorest-ws have support with the following ORMs: + +- Django +- SQLAlchemy + +You can find corresponding modules for each of mentioned ORMs in ``aiorest_ws.db.orm.*`` namespace. + +Serializers +----------- + +Defining model serializer +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Serializing +^^^^^^^^^^^ + +Deserializing +^^^^^^^^^^^^^ + +Validating and saving instances +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Partial instance updates +^^^^^^^^^^^^^^^^^^^^^^^^ + +Work with multiple objects +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Work with nested objects +^^^^^^^^^^^^^^^^^^^^^^^^ + +Serializer fields +----------------- + +BigIntegerField +^^^^^^^^^^^^^^^ + +BooleanField +^^^^^^^^^^^^ + +CharField +^^^^^^^^^ + +ChoiceField +^^^^^^^^^^^ + +CreateOnlyDefault +^^^^^^^^^^^^^^^^^ + +DateField +^^^^^^^^^ + +DateTimeField +^^^^^^^^^^^^^ + +DecimalField +^^^^^^^^^^^^ + +DictField +^^^^^^^^^ + +DurationField +^^^^^^^^^^^^^ + +EmailField +^^^^^^^^^^ + +EnumField +^^^^^^^^^ + +FileField +^^^^^^^^^ + +FilePathField +^^^^^^^^^^^^^ + +FloatField +^^^^^^^^^^ + +HStoreField +^^^^^^^^^^^ + +IPAddressField +^^^^^^^^^^^^^^ + +ImageField +^^^^^^^^^^ + +IntegerField +^^^^^^^^^^^^ + +IntervalField +^^^^^^^^^^^^^ + +JSONField +^^^^^^^^^ + +LargeBinaryField +^^^^^^^^^^^^^^^^ + +ListField +^^^^^^^^^ + +ModelField +^^^^^^^^^^ + +MultipleChoiceField +^^^^^^^^^^^^^^^^^^^ + +NullBooleanField +^^^^^^^^^^^^^^^^ + +PickleField +^^^^^^^^^^^ + +ReadOnlyField +^^^^^^^^^^^^^ + +RegexField +^^^^^^^^^^ + +SerializerMethodField +^^^^^^^^^^^^^^^^^^^^^ + +SlugField +^^^^^^^^^ + +SmallIntegerField +^^^^^^^^^^^^^^^^^ + +TimeField +^^^^^^^^^ + +URLField +^^^^^^^^ + +UUIDField +^^^^^^^^^ + +Serializer relation fields +-------------------------- + +PrimaryKeyRelatedField +^^^^^^^^^^^^^^^^^^^^^^ + +HyperlinkedRelatedField +^^^^^^^^^^^^^^^^^^^^^^^ + +HyperlinkedIdentityField +^^^^^^^^^^^^^^^^^^^^^^^^ + +StringRelatedField +^^^^^^^^^^^^^^^^^^ + +SlugRelatedField +^^^^^^^^^^^^^^^^