Skip to content

Commit

Permalink
Version update to 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jeronimoalbi committed Mar 1, 2017
1 parent 576fa18 commit 282763d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.0.0] - 2017-03-01
- Initial release
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Contributing
------------

Please first read our [contribution guidelines](https://kusanagi.io/app#katana/open-source/contributing).

* [Requesting help](https://kusanagi.io/app#katana/open-source/help)
* [Reporting a bug](https://kusanagi.io/app#katana/open-source/bug)
* [Submitting a patch](https://kusanagi.io/app#katana/open-source/patch)
* [Security issues](https://kusanagi.io/app#katana/open-source/security)

We use [milestones](https://github.com/kusanagi/katana-sdk-python3/milestones) to track upcoming releases inline with our [versioning](https://kusanagi.io/app#katana/versioning) strategy, and as defined in our [roadmap](https://kusanagi.io/app#katana/roadmap).
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ LOG = logging.getLogger('katana')
def request_handler(request):
return request
def response_handler(response):
return response
if __name__ == '__main__':
middleware = Middleware()
middleware.request(request_handler)
Expand All @@ -118,7 +118,7 @@ Now, save the module as `middleware-example.py`.

This module defines a **Middleware** that processes requests and also responses, so it's called two times per request.

The `request_handler` is called first, before any **Service** call, so there we have to set the **Service** name, version and action to call.
The `request_handler` is called first, before any **Service** call, so there we have to set the **Service** name, version and action to call.

To do so, change the `request_handler` function to the following:

Expand All @@ -127,15 +127,15 @@ def request_handler(request):
http_request = request.get_http_request()
path = http_request.get_url_path()
LOG.info('Pre-processing request to URL %s', path)
# Debug logs can also be written with the framework
request.log('Pre-processing request to URL {}'.format(path))
# These values would normally be extracted by parsing the URL
request.set_service_name('users')
request.set_service_version('0.1')
request.set_action_name('read')
return request
```

Expand All @@ -149,12 +149,12 @@ For the example, all responses will be formatted as JSON. To do so, change the `
def response_handler(response):
http_response = response.get_http_response()
http_response.set_header('Content-Type', 'application/json')
# Serialize transport to JSON and use it as response body
transport = response.get_transport()
body = json.dumps(transport.get_data())
http_response.set_body(body)
return response
```

Expand All @@ -168,7 +168,7 @@ from katana.sdk import Service
def read_handler(action):
user_id = action.get_param('id').get_value()
# Users read action returns a single user entity
action.set_entity({
'id': user_id,
Expand All @@ -177,8 +177,8 @@ def read_handler(action):
'last_name': 'Bar',
})
return action
if __name__ == '__main__':
service = Service()
service.action('read', read_handler)
Expand Down
2 changes: 1 addition & 1 deletion katana/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

__license__ = "MIT"
__copyright__ = "Copyright (c) 2016-2017 KUSANAGI S.L. (http://kusanagi.io)"
__version__ = '1.0.0-beta.14'
__version__ = '1.0.0'

0 comments on commit 282763d

Please sign in to comment.